Examples of ServletRegistration


Examples of javax.servlet.ServletRegistration

  @Override
  public void init() throws ServletException {

    //
    String path = null;
    ServletRegistration reg = getServletContext().getServletRegistration(getServletName());
    for (String mapping : reg.getMappings()) {
      if ("/".equals(mapping)) {
        path = "";
        break;
      } else if ("/*".equals(mapping)) {
        throw new UnsupportedOperationException("Implement me");
View Full Code Here

Examples of javax.servlet.ServletRegistration

  @Override
  public void onStartup( final Set<Class<?>> c, final ServletContext ctx ) throws ServletException {

    LOGGER.debug( "onStartup() called" );

    final ServletRegistration servletRegistration = ctx.getServletRegistration( ROUTEY_SERVLET_NAME );
    // if servlet not registered already
    if ( servletRegistration == null ) {
      final RouteyServlet routeyServlet = ctx.createServlet( RouteyServlet.class );

      // force eager initialization to scan routes early
View Full Code Here

Examples of org.apache.myfaces.commons.resourcehandler.webapp.config.element.ServletRegistration

        String delegateFacesServlet = WebConfigParamUtils.getStringInitParameter(context.getExternalContext(),
                INIT_PARAM_DELEGATE_FACES_SERVLET);
       
        for (Map.Entry<String, ? extends ServletRegistration> entry : webRegistration.getServletRegistrations().entrySet())
        {
            ServletRegistration registration = entry.getValue();
            boolean facesServlet = false;
            if (FacesServlet.class.getName().equals(registration.getClassName()))
            {
                facesServlet = true;
            }
            else if (delegateFacesServlet != null && delegateFacesServlet.equals(registration.getClassName()))
            {
                facesServlet = true;
            }
            else
            {
                if (DELEGATE_FACES_SERVLET_INTERFACE_CLASS != null)
                {
                    try
                    {
                        Class servletClass = ClassUtils.classForName(registration.getClassName());
                        if (DELEGATE_FACES_SERVLET_INTERFACE_CLASS.isAssignableFrom(servletClass));
                        {
                            facesServlet = true;
                        }
                    }
                    catch (ClassNotFoundException e)
                    {
                        Log log = LogFactory.getLog(ExtendedDefaultResourceHandlerSupport.class);
                        if (log.isTraceEnabled())
                        {
                            log.trace("cannot load servlet class to detect if is a FacesServlet or DelegateFacesServlet", e);
                        }
                    }
                }
            }
            if (facesServlet)
            {
                for (String urlPattern : registration.getMappings())
                {
                    String extension = urlPattern != null && urlPattern.startsWith("*.") ? urlPattern.substring(urlPattern
                            .indexOf('.')) : null;
                    if (extension == null)
                    {
View Full Code Here

Examples of org.apache.myfaces.commons.resourcehandler.webapp.config.element.ServletRegistration

                INIT_PARAM_DELEGATE_FACES_SERVLET);
       
        for (Map.Entry<String, ? extends ServletRegistration> entry :
                webRegistration.getServletRegistrations().entrySet())
        {
            ServletRegistration registration = entry.getValue();
            boolean facesServlet = false;
            if (FacesServlet.class.getName().equals(registration.getClassName()))
            {
                facesServlet = true;
            }
            else if (delegateFacesServlet != null && delegateFacesServlet.equals(registration.getClassName()))
            {
                facesServlet = true;
            }
            else
            {
                if (DELEGATE_FACES_SERVLET_INTERFACE_CLASS != null)
                {
                    try
                    {
                        Class servletClass = ClassUtils.classForName(registration.getClassName());
                        if (DELEGATE_FACES_SERVLET_INTERFACE_CLASS.isAssignableFrom(servletClass))
                        {
                            facesServlet = true;
                        }
                    }
                    catch (ClassNotFoundException e)
                    {
                        Log log = LogFactory.getLog(ExtendedDefaultResourceHandlerSupport.class);
                        if (log.isTraceEnabled())
                        {
                            log.trace("cannot load servlet class to detect if is a FacesServlet or DelegateFacesServlet"
                                     , e);
                        }
                    }
                }
            }
            if (facesServlet)
            {
                for (String urlPattern : registration.getMappings())
                {
                    String extension = urlPattern != null && urlPattern.startsWith("*.")
                                            ? urlPattern.substring(urlPattern.indexOf('.'))
                                            : null;
                    if (extension == null)
View Full Code Here

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

Examples of org.glassfish.grizzly.servlet.ServletRegistration

    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

Examples of org.glassfish.grizzly.servlet.ServletRegistration

        }

        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

Examples of org.glassfish.grizzly.servlet.ServletRegistration

        }

        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

Examples of org.glassfish.grizzly.servlet.ServletRegistration

    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

Examples of org.glassfish.grizzly.servlet.ServletRegistration

            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
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.