Package org.glassfish.grizzly.http.server

Examples of org.glassfish.grizzly.http.server.ServerConfiguration


        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);

        // add handler for serving JAX-RS resources
        config.addHttpHandler(RuntimeDelegate.getInstance().createEndpoint(createResourceConfig(), GrizzlyHttpContainer.class),
                API_PATH);

        try {
            // Start the server.
            server.start();
View Full Code Here


        //Add ExceptionMapper and create Container
        register(exceptionMapperClass);
        GrizzlyHttpContainer grizzlyHttpContainer = ContainerFactory.createContainer(GrizzlyHttpContainer.class, this);

        // Set our ServerConfiguration options
        final ServerConfiguration config = httpServer.getServerConfiguration();
        config.addHttpHandler(grizzlyHttpContainer, configuration.getHttpServer().getRootContext());
        config.setPassTraceRequest(configuration.getHttpServer().isPassTraceRequest());
        config.setTraceEnabled(configuration.getHttpServer().isTraceEnabled());
        config.setJmxEnabled(configuration.getHttpServer().isJmxEnabled());

        //Configure static resource handler if required
        if (configuration.getHttpServer().getStaticResourceDirectory() != null &&
                configuration.getHttpServer().getStaticResourceContextRoot() != null)
            config.addHttpHandler(new StaticHttpHandler(configuration.getHttpServer().getStaticResourceDirectory()),
                    configuration.getHttpServer().getStaticResourceContextRoot());

        // Now an HttpServer and NetworkListener
        final NetworkListener listener = new NetworkListener("grizzly",
                configuration.getHttpServer().getHost(), configuration.getHttpServer().getPort());
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.http.server.ServerConfiguration

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.