Package org.glassfish.grizzly.servlet

Examples of org.glassfish.grizzly.servlet.ServletRegistration


            if (path.endsWith("/"))
                path = path.substring(0, path.length() - 1);
        }

        WebappContext context = new WebappContext("GrizzlyContext", path);
        ServletRegistration registration = context.addServlet(c.getName(), c);
        registration.addMapping("");
        if (initParams == null) {
            registration.setInitParameter(ClasspathResourceConfig.PROPERTY_CLASSPATH,
                    System.getProperty("java.class.path").replace(File.pathSeparatorChar, ';'));
        } else {
            registration.setInitParameters(initParams);
        }

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


    protected static void startServer() {

        // add Jersey resource servlet
        WebappContext context = new WebappContext("context");
        ServletRegistration registration =
                context.addServlet("ServletContainer", ServletContainer.class);
        registration.setInitParameter("com.sun.jersey.config.property.packages",
                "com.sun.jersey.samples.https_grizzly.resource;com.sun.jersey.samples.https_grizzly.auth");

        // add security filter (which handles http basic authentication)
        registration.setInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS,
                SecurityFilter.class.getName());

        // Grizzly ssl configuration
        SSLContextConfigurator sslContext = new SSLContextConfigurator();
       
View Full Code Here

        }

        path = String.format("/%s", UriComponent.decodePath(u.getPath(), true).get(1).toString());

        WebappContext context = new WebappContext("GrizzlyContext", path);
        ServletRegistration registration;
        if (c != null) {
            registration = context.addServlet(c.getName(), c);
        } else {
            registration = context.addServlet(servlet.getClass().getName(), servlet);
        }
        registration.addMapping("/*");

        if (contextInitParams != null) {
            for (Map.Entry<String, String> e : contextInitParams.entrySet()) {
                context.setInitParameter(e.getKey(), e.getValue());
            }
        }

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

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

        }

        path = String.format("/%s", UriComponent.decodePath(u.getPath(), true).get(1).toString());

        WebappContext context = new WebappContext("GrizzlyContext", path);
        ServletRegistration registration = context.addServlet(c.getName(), c);
        registration.addMapping("");
        if (initParams == null) {
//            registration.setInitParameter(ClassPathResourceConfig.PROPERTY_CLASSPATH,
//                    System.getProperty("java.class.path").replace(File.pathSeparatorChar, ';'));
        } else {
            registration.setInitParameters(initParams);
        }

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

    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());
    reg.setInitParameter("logLevel", logLevel.getName());
    reg.addMapping("/*");
    reg.setLoadOnStartup(1);
    webappContext.deploy(ws);

    System.out.println();
    System.out.println("  .:::::::::.");
    System.out.println("   ::::::::: ");
View Full Code Here

            WebappContext context =
                    new WebappContext("TestContext", contextPathLocal);

            if (servletClass != null) {
                ServletRegistration registration =
                        context.addServlet(servletClass.getName(), servletClass);
                for(String initParamName : initParams.keySet()) {
                    registration.setInitParameter(initParamName, initParams.get(initParamName));
                }


                registration.addMapping(servletPathLocal);
            } else {
                ServletRegistration registration =
                        context.addServlet("default", new HttpServlet() {
                            @Override
                            protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
                                resp.setStatus(404);
                            }
                        });
                registration.addMapping("");
            }

            for(Class<? extends EventListener> eventListener : eventListeners) {
                context.addListener(eventListener);
            }
View Full Code Here

    }

    protected static void startServer() {
      // add CXF resource servlet
        WebappContext context = new WebappContext("context");
        ServletRegistration registration =
            context.addServlet("ServletContainer", CXFServlet.class);
        context.addListener("org.springframework.web.context.ContextLoaderListener");
        context.addContextInitParameter("contextConfigLocation", "beans.xml");

        // Grizzly ssl configuration
View Full Code Here

                securityFilter.configure(properties.getConfiguration());
                rc.getContainerRequestFilters().add(securityFilter);
            }

            final ServletRegistration sg = wacJersey.addServlet("jersey", new ServletContainer(rc));
            sg.addMapping("/*");
            wacJersey.deploy(this.httpServer);
        }
    }
View Full Code Here

        // main.html back to the calling client.  main.html handles its own
        // state given the uri
        if (hasAnythingChanged()) {
            if (enableDogHouse) {
                this.wacDogHouse = new WebappContext("doghouse", "");
                final ServletRegistration sgDogHouse = wacDogHouse.addServlet("doghouse", new DogHouseServlet());
                sgDogHouse.addMapping("/doghouse/*");
                sgDogHouse.setInitParameter("com.tinkerpop.rexster.config.rexsterApiBaseUri", baseUri + ":" + rexsterServerPort.toString());

                final ServletRegistration sgDogHouseEval = wacDogHouse.addServlet("doghouse-evaluator", new EvaluatorServlet(application));
                sgDogHouseEval.addMapping("/doghouse/exec");

                wacDogHouse.deploy(this.httpServer);
            }
        }
    }
View Full Code Here

                wacMetrics = new WebappContext("metrics", "");
                wacMetrics.setAttribute("com.codahale.metrics.servlets.MetricsServlet.registry", application.getMetricRegistry());
                wacMetrics.addContextInitParameter("com.codahale.metrics.servlets.MetricsServlet.rateUnit", this.convertRateTo);
                wacMetrics.addContextInitParameter("com.codahale.metrics.servlets.MetricsServlet.durationUnit", this.convertDurationTo);

                final ServletRegistration sgMetrics = wacMetrics.addServlet("metrics", new MetricsServlet());
                sgMetrics.addMapping("/metrics/*");

                wacMetrics.deploy(this.httpServer);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.servlet.ServletRegistration

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.