Package org.mortbay.jetty.servlet

Examples of org.mortbay.jetty.servlet.ServletHandler


                        staticContext.start();
                    }
                   
                    appContext = context.addContext(pathPattern, "");

                    ServletHandler handler = new ServletHandler();
                    Class servletClass = servletClassName == null ?
                            EmbeddedServletClient.class : Class.forName(servletClassName);

                    ServletHolder holder = new ServletHolder(servletClass);
                    handler.addServletWithMapping(holder, "/*");

                    holder.setInitParameter("application", appName);
                    // holder.setInitParameter("mountpoint", mountpoint);

                    if (cookieDomain != null) {
View Full Code Here


    ContextHandler contextHandler = new ContextHandler();
    contextHandler.setContextPath( "" );
    server.addHandler( contextHandler );

    // Create a servlet container
    ServletHandler servlets = new ServletHandler();
    contextHandler.addHandler( servlets );

    contextHandler.setAttribute( "queryEngine", queryEngine );
    contextHandler.setAttribute( "collection", collection );
    contextHandler.setAttribute( "titleList", titleList );
    contextHandler.setAttribute( "action", "/Query" );
    // TODO: very rudimentary: we should get the template from somewhere else instead...
    contextHandler.setAttribute( "template", System.getProperty( "it.unimi.dsi.mg4j.query.QueryServlet.template" ) );

    // Maps the main servlet onto the container.
    servlets.addServletWithMapping( QueryServlet.class, "/Query" );
    servlets.addServletWithMapping( HelpPage.class, "/Help" );
   
    /* If an item servlet was specified, we link it to /Item. Otherwise,
     * we inform the query servlet that it should generate direct URIs. */

    if ( itemClass != null ) {
      servlets.addServletWithMapping( itemClass, "/Item" );
      if ( itemClass == FileSystemItem.class ) contextHandler.setAttribute( "derelativise", Boolean.TRUE );
    }
    else contextHandler.setAttribute( "uri", Boolean.TRUE );

    contextHandler.setAttribute( "mimeType", itemMimeType );
View Full Code Here

        getServiceRegistry().register(service);

        // Create the server
        server = new Server(8391);
        ServletHandler handler = new ServletHandler ();
       
        Context context = new Context(server,"/",Context.SESSIONS);
       
        ServletHolder servlet = new ServletHolder(new XFireServlet());
        handler.addServlet(servlet);
       
        context.addServlet(servlet, "/*");
       
        context.addFilter("com.planetj.servlet.filter.compression.CompressingFilter", "/*", 0);
       
View Full Code Here

        httpContext.setRedirectNullPath(false);
        server.addContext(httpContext);

        // Dunny servlet handler for faking HttpServletRequest,
        // HttpServletResponse
        servletHandler = new ServletHandler();
        servletHandler.initialize(httpContext);
        servletHandler.start();

        // Add the webapp
        webappContext = new CustomWebApplicationContext(useDevConfig, bootLoader);
View Full Code Here

    }

    private void resetJettyFilterMappings() {
        //This causes jetty to recompute the filter to servlet mappings based on the
        //current servlet names in the filter mappings.  Pretty inefficient.
        ServletHandler servletHandler = jettyServletRegistration.getServletHandler();
        FilterMapping[] filterMappings = servletHandler.getFilterMappings();
        FilterMapping[] copy = filterMappings.clone();
        servletHandler.setFilterMappings(copy);
    }
View Full Code Here

            JAASJettyRealm realm = new JAASJettyRealm(realmName, internalJAASJettyRealm);
            Subject defaultSubject =  this.runAsSource.getDefaultSubject();
            securityHandler = new JettySecurityHandler(authenticator, realm, policyContextID, defaultSubject);
        }

        ServletHandler servletHandler = new ServletHandler();

        webAppContext = new TwistyWebAppContext(securityHandler, sessionHandler, servletHandler, null);
        //See Jetty-386.  Setting this to true can expose secured content.
        webAppContext.setCompactPath(compactPath);
View Full Code Here

            securityHandler.setUserRealm(realm);

            securityHandler.init(policyContextID, defaultPrincipal, checkedPermissions, excludedPermissions, classLoader);
        }

        ServletHandler servletHandler = new ServletHandler();

        webAppContext = new WebAppContext(securityHandler, sessionHandler, servletHandler, null);
        AbstractHandler next = sessionHandler;
        next = new ThreadClassloaderHandler(next, classLoader);
View Full Code Here

    }
    webAppContext.addServlet(holder, pathSpec);
   
    if(requireAuth && UserGroupInformation.isSecurityEnabled()) {
       LOG.info("Adding Kerberos filter to " + name);
       ServletHandler handler = webAppContext.getServletHandler();
       FilterMapping fmap = new FilterMapping();
       fmap.setPathSpec(pathSpec);
       fmap.setFilterName("krb5Filter");
       fmap.setDispatches(Handler.ALL);
       handler.addFilterMapping(fmap);
    }
  }
View Full Code Here

    holder.setInitParameters(parameters);
    FilterMapping fmap = new FilterMapping();
    fmap.setPathSpecs(urls);
    fmap.setDispatches(Handler.ALL);
    fmap.setFilterName(name);
    ServletHandler handler = ctx.getServletHandler();
    handler.addFilter(holder, fmap);
  }
View Full Code Here

   * @param pathSpec The path spec
   * @param webAppCtx The WebApplicationContext to add to
   */
  protected void addFilterPathMapping(String pathSpec,
      Context webAppCtx) {
    ServletHandler handler = webAppCtx.getServletHandler();
    for(String name : filterNames) {
      FilterMapping fmap = new FilterMapping();
      fmap.setPathSpec(pathSpec);
      fmap.setFilterName(name);
      fmap.setDispatches(Handler.ALL);
      handler.addFilterMapping(fmap);
    }
  }
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.servlet.ServletHandler

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.