Package com.sun.net.httpserver

Examples of com.sun.net.httpserver.HttpServer.start()


            }
        }
        HttpServer server = HttpServer.create(new InetSocketAddress(addr, port), 2);
        server.createContext("/", new WebhookHandler());
        server.setExecutor(null);
        server.start();
    }

}
View Full Code Here


    // map JAX-RS handler to the server root
    server.createContext(getBaseURI().getPath(), handler);

    // start the server
    server.start();

    return server;
  }

  /**
 
View Full Code Here

        };
        server.createContext("/exit", new ExitHandler(c));

        // Bind and start server
        server.bind(new InetSocketAddress(Config.getPort()), 0);
        server.start();
    }

    public static void main(String[] args) throws Exception {
        initMetricsPublishing();
        initHttpServer();
View Full Code Here

        HttpServer server = HttpServer.create(new InetSocketAddress(port), 1);
        server.createContext("/repo", new RepoFileHandler(repo.getPath(), herd, rq));
        // make sure we serve at least two concurrent connections, as each one might take a few ms to close
        ThreadPoolExecutor tpool = (ThreadPoolExecutor)Executors.newFixedThreadPool(2);
        server.setExecutor(tpool);
        server.start();
        return server;
    }

    private File makeRepo() {
        File repo = new File("build/test-cars-http");
View Full Code Here

                    httpExchange.sendResponseHeaders(HttpURLConnection.HTTP_NOT_IMPLEMENTED, -1);
                }
                httpExchange.close();
            }
        });
        stubServer.start();
       
        try {
            String repoUrl = "http://localhost:" + stubServer.getAddress().getPort() + "/repo";
            externalLinks(repoUrl, "file://not-existing-dir", "https://not-existing-url", repoUrl);
        } finally {
View Full Code Here

                    server = HttpServer.create(inetAddress, 5);
                    server.setExecutor(Executors.newCachedThreadPool());
                    String path = url.toURI().getPath();
                    logger.fine("Creating HTTP Context at = "+path);
                    HttpContext context = server.createContext(path);
                    server.start();
                    logger.fine("HTTP server started = "+inetAddress);
                    state = new ServerState(server);
                    servers.put(inetAddress, state);
                    return context;
                }
View Full Code Here

        // map JAX-RS handler to the server root
        server.createContext(getBaseURI().getPath(), handler);

        // start the server
        server.start();

        return server;
    }

    @SuppressWarnings("ResultOfMethodCallIgnored")
View Full Code Here

            server.createContext("/getscreen", new ConsoleProxyThumbnailHandler());
            server.createContext("/resource/", new ConsoleProxyResourceHandler());
            server.createContext("/ajax", new ConsoleProxyAjaxHandler());
            server.createContext("/ajaximg", new ConsoleProxyAjaxImageHandler());
            server.setExecutor(new ThreadExecutor()); // creates a default executor
            server.start();
        } catch(Exception e) {
            s_logger.error(e.getMessage(), e);
            System.exit(1);
        }
    }
View Full Code Here

        try {
            s_logger.info("Listening for HTTP CMDs on port " + httpCmdListenPort);
            HttpServer cmdServer = HttpServer.create(new InetSocketAddress(httpCmdListenPort), 2);
            cmdServer.createContext("/cmd", new ConsoleProxyCmdHandler());
            cmdServer.setExecutor(new ThreadExecutor()); // creates a default executor
            cmdServer.start();
        } catch(Exception e) {
            s_logger.error(e.getMessage(), e);
            System.exit(1);
        }
    }
View Full Code Here

        HttpServer server;
    try {
      server = HttpServer.create(addr, 0);
          server.createContext("/", new GEHttpHandler());
          server.setExecutor(Executors.newCachedThreadPool());
          server.start();
         
          BufferedReader reader = new BufferedReader(new FileReader("kml.xml"));
          StringBuilder sb = new StringBuilder();
          String line = null;
          while((line = reader.readLine()) != null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.