Package org.glassfish.grizzly.http.server

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


        return GrizzlyWebContainerFactory.create(BASE_URI, initParams);
    }
   
    public static void main(String[] args) throws IOException {
        // Grizzly 2 initialization
        HttpServer httpServer = startServer();
        System.out.println(String.format("Jersey app started with WADL available at "
                + "%sapplication.wadl\nHit enter to stop it...",
                BASE_URI));
        System.in.read();
        httpServer.stop();
    }   
View Full Code Here


 

  public static void main(String[] args) throws IOException {
    System.err.println("Bruk mvn jetty:run -Djetty.port=9998");
    System.exit(1);
    HttpServer httpServer = startServer();
    /*JspServlet servlet = new JspServlet();
    WebappContext ctx = new WebappContext("J-to-the-S-to-the-P", "/", "src/main/webapp");
    ServletRegistration reg = ctx.addServlet("JayEssPee", servlet);
    reg.addMapping("*.jsp");
    FilterRegistration filterReg = ctx.addFilter("AuthFilter", new AuthFilter());

    filterReg.addMappingForUrlPatterns(null , "/app/*");
    ctx.deploy(httpServer);
    */
    System.out
        .println(String
            .format("Jersey app started with WADL available at "
                + "%sapplication.wadl\nTry out %shelloworld\nHit enter to stop it...",
                BASE_URI, BASE_URI));
    System.in.read();   
    httpServer.stop();
  }
View Full Code Here

        listener.setSecure(secure);
        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,}", "/");
           
            config.addHttpHandler(handler,
                    HttpHandlerRegistration.bulder()
                    .contextPath(path.endsWith("/")
                            ? path.substring(0, path.length() - 1)
                            : path)
                    .build()
            );
        }

        config.setPassTraceRequest(true);

        if (start) {
            try {
                // Start the server.
                server.start();
            } catch (final IOException ex) {
                server.shutdownNow();
                throw new ProcessingException(LocalizationMessages.FAILED_TO_START_SERVER(ex.getMessage()), ex);
            }
        }

        return server;
View Full Code Here

     * Main method.
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        final HttpServer server = startServer();
        System.out.println(String.format("Jersey app started with WADL available at "
                + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));
        System.in.read();
        server.stop();
    }
View Full Code Here

        if (initParams != null) {
            registration.setInitParameters(initParams);
        }

        HttpServer server = GrizzlyHttpServerFactory.createHttpServer(u);
        context.deploy(server);
        return server;
    }
View Full Code Here

     * Root resource path.
     */
    static final String ROOT_PATH = "patchable-state";

    public static void main(String[] args) {
        HttpServer server = null;
        try {
            System.out.println("Jersey HTTP PATCH Support Example App");

            server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, create());

            System.out.println(String.format("Application started.\nTry out %s%s\nHit enter to stop it...",
                    BASE_URI,
                    ROOT_PATH));

            System.in.read();
        } catch (IOException ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE,
                    "Exception occurred while running the application. Shutting down...", ex);
        } finally {
            if (server != null) {
                server.shutdownNow();
            }
        }
    }
View Full Code Here

    public static void main(String[] args) {
        try {
            System.out.println("Clipboard Jersey Example App");

            final ResourceConfig config = createProgrammaticClipboardApp();
            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, config);

            System.out.println(
                    String.format("Application started.%n"
                            + "Try out %s%s%n"
                            + "Hit enter to stop it...",
                            BASE_URI, ROOT_PATH));
            System.in.read();
            server.shutdownNow();
        } catch (IOException ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
View Full Code Here

    public static void main(String[] args) throws Exception {
            System.out.println("Jersey performance test web service application");

            final ResourceConfig resourceConfig = new ResourceConfig(DynamicallyBoundInterceptorResource.class, DynamicallyBoundInterceptor.class);
            URI baseUri = args.length > 0 ? URI.create(args[0]) : BASE_URI;
            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig);

            System.out.println(String.format("Application started.\nTry out %s%s\nHit Ctrl-C to stop it...",
                    baseUri, ROOT_PATH));

            while (server.isStarted()) {
                Thread.sleep(600000);
            }
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
            System.out.println("Jersey performance test web service application");

            final ResourceConfig resourceConfig = new ResourceConfig(SrlResource.class);
            URI baseUri = args.length > 0 ? URI.create(args[0]) : BASE_URI;
            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig);

            System.out.println(String.format("Application started.\nTry out %s%s\nHit Ctrl-C to stop it...",
                    baseUri, ROOT_PATH));

            while (server.isStarted()) {
                Thread.sleep(600000);
            }
    }
View Full Code Here

    public static void main(final String[] args) throws Exception {
            System.out.println("Jersey performance test web service application");

            final URI baseUri = args.length > 0 ? URI.create(args[0]) : BASE_URI;
            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, createResourceConfig());

            System.out.println(String.format("Application started.\nTry out %s%s\nHit Ctrl-C to stop it...",
                    baseUri, ROOT_PATH));

            while (server.isStarted()) {
                Thread.sleep(600000);
            }
    }
View Full Code Here

TOP

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

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.