Package com.sun.net.httpserver

Examples of com.sun.net.httpserver.HttpHandler


                    }
                }
            } );               
           
           
            httpsServer.createContext("/test", new HttpHandler() {           
                @Override
                public void handle(HttpExchange t) throws IOException {
                    LOGGER.info("https server working");
                    t.getRequestBody().close();                                                               
                    t.sendResponseHeaders(200, 0);
View Full Code Here


  public void start() {
    try {
      InetSocketAddress address = new InetSocketAddress(port);
      SunHttpAuthenticator sha = new SunHttpAuthenticator(authenticator);
      httpServer = httpServer.create(address, -1);
      HttpHandler startHandler = new AuthenticationHandler(new StartHandler(server));
      HttpHandler cancelHandler = new AuthenticationHandler(new CancelHandler(server));
      HttpHandler pollHandler = new AuthenticationHandler(new PollHandler(server));
      HttpHandler createReplHandler = new AuthenticationHandler(new CreateReplHandler(server));
      HttpHandler evalHandler = new AuthenticationHandler(new EvalHandler(server));
      HttpHandler closeReplHandler = new AuthenticationHandler(new CloseReplHandler(server));
      httpServer.createContext("/start", startHandler).setAuthenticator(sha);
        httpServer.createContext("/cancel", cancelHandler).setAuthenticator(sha);
        httpServer.createContext("/poll", pollHandler).setAuthenticator(sha);
        httpServer.createContext("/createRepl", createReplHandler).setAuthenticator(sha);
        httpServer.createContext("/eval", evalHandler).setAuthenticator(sha);
View Full Code Here

            final ExecutorService threads  = Executors.newFixedThreadPool(2);
            server.setExecutor(threads);
            server.start();

            HttpContext context = server.createContext("/stop");
            context.setHandler(new HttpHandler() {
                public void handle(HttpExchange msg) throws IOException {
                    System.out.println("Shutting down the Endpoint");
                    endpoint.stop();
                    System.out.println("Endpoint is down");
                    msg.sendResponseHeaders(200, 0);
View Full Code Here

        final ExecutorService threads  = Executors.newFixedThreadPool(2);
        server.setExecutor(threads);
        server.start();

        HttpContext context = server.createContext("/stop");
        context.setHandler(new HttpHandler() {
        public void handle(HttpExchange msg) throws IOException {
        System.out.println("Shutting down the Endpoint");
        endpoint.stop();
        System.out.println("Endpoint is down");
                msg.sendResponseHeaders(200, 0);
View Full Code Here

            final ExecutorService threads  = Executors.newFixedThreadPool(2);
            server.setExecutor(threads);
            server.start();

            HttpContext context = server.createContext("/stop");
            context.setHandler(new HttpHandler() {
                public void handle(HttpExchange msg) throws IOException {
                    System.out.println("Shutting down the Endpoint");
                    endpoint.stop();
                    System.out.println("Endpoint is down");
                    msg.sendResponseHeaders(200, 0);
View Full Code Here

        final ExecutorService threads  = Executors.newFixedThreadPool(2);
        server.setExecutor(threads);
        server.start();

        HttpContext context = server.createContext("/stop");
        context.setHandler(new HttpHandler() {
        public void handle(HttpExchange msg) throws IOException {
        System.out.println("Shutting down the Endpoint");
        endpoint.stop();
        System.out.println("Endpoint is down");
                msg.sendResponseHeaders(200, 0);
View Full Code Here

TOP

Related Classes of com.sun.net.httpserver.HttpHandler

Copyright © 2018 www.massapicom. 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.