Package com.sun.net.httpserver

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


                    return context;
                }
            }
            server = state.getServer();
            logger.fine("Creating HTTP Context at = "+url.getPath());
            HttpContext context = server.createContext(url.getPath());
            state.oneMoreContext();
            return context;
        } catch(Exception e) {
            throw new ServerRtException("server.rt.err",e );
        }
View Full Code Here


       
        HttpServer server = new JettyHttpServerProvider().createHttpServer(new
                InetSocketAddress(host, port), 10);
        server.start();
       
        final HttpContext httpContext = server.createContext("/",
                new HttpHandler()
        {

            public void handle(HttpExchange exchange) throws IOException
            {
View Full Code Here

        HttpServer httpServer = HttpServer.create(address, 0);
        final String path = "/notify";
        final AtomicBoolean notified = new AtomicBoolean(false);


        httpServer.createContext(path, new HttpHandler() {
            @Override
            public void handle(HttpExchange httpExchange) throws IOException {
                notified.set(true);
                httpExchange.sendResponseHeaders(200, 0);
                httpExchange.close();
View Full Code Here

                exchange.getResponseBody().write(response);
                exchange.close();
            }
        };
        final String urlPath = "/1234.xml";
        httpServer.createContext(urlPath, requestHandler);
        try {
            httpServer.start();
            final XmlRequest xmlRequest = new GeonetHttpRequestFactory().createXmlRequest(new URL ("http://localhost:"+port+ urlPath));
            final Element response = xmlRequest.execute();
            assertEquals(Xml.getString(expectedResponse), Xml.getString(response));
View Full Code Here

                exchange.getResponseBody().write(response);
                exchange.close();
            }
        };
        final String finalUrlPath = "/final.xml";
        httpServer.createContext(finalUrlPath, finalHandler);

        HttpHandler permRedirectHandler = new HttpHandler() {

            @Override
            public void handle(HttpExchange exchange) throws IOException {
View Full Code Here

                exchange.getResponseBody().write(response);
                exchange.close();
            }
        };
        final String permUrlPath = "/permRedirect.xml";
        httpServer.createContext(permUrlPath, permRedirectHandler);

        HttpHandler tempRedirectHandler = new HttpHandler() {

            @Override
            public void handle(HttpExchange exchange) throws IOException {
View Full Code Here

                exchange.getResponseBody().write(response);
                exchange.close();
            }
        };
        final String tempUrlPath = "/tempRedirect.xml";
        httpServer.createContext(tempUrlPath, tempRedirectHandler);


        try {
            httpServer.start();
            XmlRequest xmlRequest = new GeonetHttpRequestFactory().createXmlRequest(new URL ("http://localhost:"+port+ permUrlPath));
View Full Code Here

                s_logger.error("Unable to load HTTP server factory");
                System.exit(1);
            }

            HttpServer server = factory.createHttpServerInstance(httpListenPort);
            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();
View Full Code Here

                System.exit(1);
            }

            HttpServer server = factory.createHttpServerInstance(httpListenPort);
            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) {
View Full Code Here

            }

            HttpServer server = factory.createHttpServerInstance(httpListenPort);
            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);
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.