Package org.glassfish.grizzly.http.server

Examples of org.glassfish.grizzly.http.server.HttpServer.addListener()


        networkListener.registerAddOn(new HttpPipelineOptAddOn());
       
        // disable file-cache
        networkListener.getFileCache().setEnabled(false);
       
        httpServer.addListener(networkListener);
       
        httpServer.getServerConfiguration().addHttpHandler(
                new RootHttpHandler(), "/");
//        httpServer.getServerConfiguration().addHttpHandler(
//                new PlainTextHttpHandler(), "/plaintext");
View Full Code Here


                    : u.getHost();
            final int port = (u.getPort() == -1) ? 80 : u.getPort();

            final HttpServer server = new HttpServer();
            final NetworkListener listener = new NetworkListener("grizzly", host, port);
            server.addListener(listener);

            // Map the path to the processor.
            final ServerConfiguration config = server.getServerConfiguration();
            config.addHttpHandler(handler, u.getPath());
View Full Code Here

        listener.setSecure(secure);
        if(sslEngineConfigurator != null) {
            listener.setSSLEngineConfig(sslEngineConfigurator);
        }

        server.addListener(listener);

        // Map the path to the processor.
        final ServerConfiguration config = server.getServerConfiguration();
        config.addHttpHandler(handler, u.getPath());
View Full Code Here

        if (sslEngineConfigurator != null) {
            listener.setSSLEngineConfig(sslEngineConfigurator);
        }

        final HttpServer server = new HttpServer();
        server.addListener(listener);

        // Map the path to the processor.
        final ServerConfiguration config = server.getServerConfiguration();
        if (handler != null) {
            final String path = uri.getPath().replaceAll("/{2,}", "/");
View Full Code Here

    public static HttpServer startServer(String webRootPath) {
        final HttpServer server = new HttpServer();
        final NetworkListener listener = new NetworkListener("grizzly", "localhost", PORT);

        server.addListener(listener);

        final ServerConfiguration config = server.getServerConfiguration();
        // add handler for serving static content
        config.addHttpHandler(new CLStaticHttpHandler(Main.class.getClassLoader(), WEB_ROOT), APP_PATH);
View Full Code Here

    public static HttpServer startServer(String webRootPath) {
        final HttpServer server = new HttpServer();
        final NetworkListener listener = new NetworkListener("grizzly", "localhost", PORT);

        server.addListener(listener);

        final ServerConfiguration config = server.getServerConfiguration();
        // add handler for serving static content
        config.addHttpHandler(new CLStaticHttpHandler(Main.class.getClassLoader(), WEB_ROOT), APP_PATH);
View Full Code Here

     */
    public static HttpServer startServer(String webRootPath) {
        final HttpServer server = new HttpServer();
        final NetworkListener listener = new NetworkListener("grizzly", "localhost", PORT);

        server.addListener(listener);

        final ServerConfiguration config = server.getServerConfiguration();
        // add handler for serving static content
        config.addHttpHandler(new StaticContentHandler(webRootPath),
                APP_PATH);
View Full Code Here

      System.setProperty(ALLOW_ENCODED_SLASH, "true");
    }

    HttpServer ws = new HttpServer();
    ws.getHttpHandler().setAllowEncodedSlash(true);
    ws.addListener(new NetworkListener("web",listenInterface,port));
    DovetaildbServlet ddbServlet = new DovetaildbServlet();
   
    WebappContext webappContext = new WebappContext("webapp", "/");
    ServletRegistration reg = webappContext.addServlet("dovetaildb", ddbServlet);
    reg.setInitParameter("headerFile", headerFile.getAbsolutePath());
View Full Code Here

            CompressionConfig cc = listener.getCompressionConfig();
            cc.setCompressionMode(CompressionConfig.CompressionMode.ON);
            cc.setCompressionMinSize(50000); // the min number of bytes to compress
            cc.setCompressableMimeTypes("application/json", "text/json"); // the mime types to compress
            listener.getTransport().setWorkerThreadPoolConfig(threadPoolConfig);
            httpServer.addListener(listener);
        }

        /* Add a few handlers (~= servlets) to the Grizzly server. */

        /* 1. A Grizzly wrapper around the Jersey Application. */
 
View Full Code Here

        listener.setSecure(secure);
        if(sslEngineConfigurator != null) {
            listener.setSSLEngineConfig(sslEngineConfigurator);
        }

        server.addListener(listener);

        // Map the path to the processor.
        final ServerConfiguration config = server.getServerConfiguration();
        if (handler != null) {
            config.addHttpHandler(handler, u.getPath());
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.