private void createServer()

in src/main/java/org/apache/datasketches/server/SketchServer.java [52:99]


  private void createServer() {
    server = new Server();

    // configure port
    final ServerConnector http = new ServerConnector(server);
    http.setHost("localhost");
    http.setPort(config.getPort());
    server.addConnector(http);

    // Error page unless you have a correct URL
    final ContextHandler contextRoot = new ContextHandler("/");
    contextRoot.setErrorHandler(new ErrorHandler());

    // Add specific handlers
    final ContextHandler contextStatus = new ContextHandler("/" + STATUS_PATH);
    contextStatus.setHandler(new StatusHandler(sketches));
    contextStatus.setAllowNullPathInfo(true);

    final ContextHandler contextSerialize = new ContextHandler("/" + SERIALIZE_PATH);
    contextSerialize.setHandler(new SerializationHandler(sketches));
    contextSerialize.setAllowNullPathInfo(true);

    final ContextHandler contextUpdate = new ContextHandler("/" + UPDATE_PATH);
    contextUpdate.setHandler(new UpdateHandler(sketches));
    contextUpdate.setAllowNullPathInfo(true);

    final ContextHandler contextMerge = new ContextHandler("/" + MERGE_PATH);
    contextMerge.setHandler(new MergeHandler(sketches));
    contextMerge.setAllowNullPathInfo(true);

    final ContextHandler contextQuery = new ContextHandler("/" + QUERY_PATH);
    contextQuery.setHandler(new DataQueryHandler(sketches));
    contextQuery.setAllowNullPathInfo(true);

    final ContextHandler contextReset = new ContextHandler("/" + RESET_PATH);
    contextReset.setHandler(new ResetHandler(sketches));
    contextReset.setAllowNullPathInfo(true);

    final ContextHandlerCollection contexts =
        new ContextHandlerCollection(contextRoot,
            contextStatus,
            contextSerialize,
            contextUpdate,
            contextMerge,
            contextQuery,
            contextReset);
    server.setHandler(contexts);
  }