Package org.glassfish.grizzly.http.server

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


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

            final ResourceConfig resourceConfig = new ResourceConfig(InterceptedByNameResource.class, NameBoundInterceptor.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) {
        try {
            System.out.println("Jersey Entity Data Filtering Example.");

            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, new SelectableEntityFilteringApplication());

            System.out.println("Application started.\nTry out one of these URIs:");
            for (final String path : new String[]{"people/1234", "people/1234?select=familyName,givenName",
                    "people/1234?select=region,addresses.region",
                    "people/1234?select=familyName,givenName,addresses.phoneNumber.number"}) {
                System.out.println(BASE_URI + path);
            }
            System.out.println("Hit enter to stop it...");

            System.in.read();

            server.shutdownNow();
        } catch (IOException ex) {
            Logger.getLogger(App.class.getName())
                    .log(Level.SEVERE, "I/O error occurred during reading from an system input stream.", ex);
        }
    }
View Full Code Here

    @SuppressWarnings("ResultOfMethodCallIgnored")
    public static void main(String[] args) {
        try {
            System.out.println("\"Custom Executor Managed Async Resources\" Jersey Example App");

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

            System.out.println(String.format("Application started.\n" +
                    "To test long-running asynchronous operation resource, try %s%s\n" +
                    "To test async chat resource, try %s%s\n" +
                    "Hit enter to stop it...", BASE_URI, ASYNC_LONG_RUNNING_MANAGED_OP_PATH, BASE_URI, "chat"));

            System.in.read();

            server.shutdownNow();
        } catch (IOException ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
View Full Code Here

    @SuppressWarnings({"ResultOfMethodCallIgnored"})
    public static void main(String[] args) {
        try {
            System.out.println("JSONP Jersey Example App");

            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, createApp());

            System.out.println(String.format("Application started.%nTry out %s%s%nHit 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) {
        try {
            System.out.println("System Properties Jersey Example App");

            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, createApp());

            System.out.println(
                    String.format("Application started.%n"
                            + "Try out %s%n"
                            + "Hit enter to stop it...",
                            BASE_URI + "/properties"));
            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) {
        try {
            System.out.println("JAX-RS Type Injection Jersey Example App");

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

            System.out.println(String.format(
                    "Application started.%n"
                            + "To test injection into a programmatic resource, try out:%n  %s%s%s%n"
                            + "To test instance injection into an annotated resource, try out:%n  %s%s%s%n"
                            + "To test method injection into an annotated resource, try out:%n  %s%s%s%n"
                            + "Hit enter to stop it...",
                    BASE_URI, ROOT_PATH_PROGRAMMATIC, "?q1=<value_1>&q2=<value_2>&q2=<value_3>",
                    BASE_URI, ROOT_PATH_ANNOTATED_INSTANCE, "?q1=<value_1>&q2=<value_2>&q2=<value_3>",
                    BASE_URI, ROOT_PATH_ANNOTATED_METHOD, "?q1=<value_1>&q2=<value_2>&q2=<value_3>"));
            System.in.read();
            server.shutdownNow();
        } catch (IOException ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
View Full Code Here

                public void onShutdown(final Container container) {
                    // ignore
                }
            });

            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, resourceConfig);

            System.out.println(String.format("Application started.\nTry out %s%s\nHit enter to stop it...", BASE_URI, ROOT_PATH));
            System.in.read();
            server.shutdownNow();
        } catch (final IOException ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
View Full Code Here

            System.out.println("\"Declarative Linking\" Jersey Example App");

            final ResourceConfig resourceConfig = new ResourceConfig(ItemsResource.class);
            resourceConfig.register(DeclarativeLinkingFeature.class);
            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, resourceConfig);


            System.out.println(String.format("Application started.\nTry out curl -L %s%s\nHit 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) {
        try {
            System.out.println("Jersey Entity Data Filtering Example.");

            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, new SecurityEntityFilteringApplication());

            System.out.println("Application started.\nTry out one of these URIs:");
            for (final String path : new String[]{"unrestricted-resource", "restricted-resource/denyAll",
                    "restricted-resource/permitAll", "restricted-resource/rolesAllowed",
                    "restricted-resource/runtimeRolesAllowed?roles=manager,user"}) {
                System.out.println(BASE_URI + path);
            }
            System.out.println("Hit enter to stop it...");

            System.in.read();

            server.shutdownNow();
        } catch (IOException ex) {
            Logger.getLogger(App.class.getName())
                    .log(Level.SEVERE, "I/O error occurred during reading from an system input stream.", ex);
        }
    }
View Full Code Here

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

            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, new EntityFilteringApplication());

            System.out.println("Application started.\nTry out one of these URIs:");
            for (final String path : new String[]{"projects", "projects/detailed", "users", "users?detailed=true", "tasks",
                    "tasks/detailed"}) {
                System.out.println(BASE_URI + path);
            }
            System.out.println("Hit enter to stop it...");

            System.in.read();

            server.shutdownNow();
        } catch (IOException ex) {
            Logger.getLogger(App.class.getName())
                    .log(Level.SEVERE, "I/O error occurred during reading from an system input stream.", ex);
        }
    }
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.