Package org.eclipse.jetty.servlet

Examples of org.eclipse.jetty.servlet.ServletMapping


    public void registerServletHolder(ServletHolder servletHolder, String servletName, Set<String> servletMappings, String objectName) throws Exception {
        webAppContext.getServletHandler().addServlet(servletHolder);
        if (servletMappings != null) {
            for (String urlPattern : servletMappings) {
                ServletMapping servletMapping = new ServletMapping();
                servletMapping.setPathSpec(urlPattern);
                servletMapping.setServletName(servletName);
                this.webAppContext.getServletHandler().addServletMapping(servletMapping);
            }
        }
        if (objectName != null) {
            synchronized (servletNames) {
View Full Code Here


        holder.setClassName(HttpTunnelServlet.class.getName());
        servletHandler.setServlets(new ServletHolder[] {
            holder
        });

        ServletMapping mapping = new ServletMapping();
        mapping.setServletName("httpTunnel");
        mapping.setPathSpec("/*");
        servletHandler.setServletMappings(new ServletMapping[] {
            mapping
        });

        contextHandler.setAttribute("acceptListener", getAcceptListener());
View Full Code Here

        holder.setClassName(StompServlet.class.getName());
        servletHandler.setServlets(new ServletHolder[] {
            holder
        });

        ServletMapping mapping = new ServletMapping();
        mapping.setServletName("WSStomp");
        mapping.setPathSpec("/*");
        servletHandler.setServletMappings(new ServletMapping[] {
            mapping
        });

        contextHandler.setAttribute("acceptListener", getAcceptListener());
View Full Code Here

    private void initializeTextPreprocessorSupport() {
        ServletHolder holder = new ServletHolder(
                new TextPreprocessingHandlerServlet());
        getServletHandler().addServlet(holder);

        ServletMapping map = new ServletMapping();
        map.setServletName(holder.getName());
        map.setPathSpecs(TextPreprocessingHandlerServlet.FILENAME_PATTERNS);
        getServletHandler().addServletMapping(map);
    }
View Full Code Here

            return;

        ServletHolder holder = new ServletHolder(new TinyCGIHandlerServlet());
        getServletHandler().addServlet(holder);

        ServletMapping map = new ServletMapping();
        map.setServletName(holder.getName());
        map.setPathSpecs(linkFiles.toArray(new String[linkFiles.size()]));
        try {
            PathMap.setPathSpecSeparators("!");
            getServletHandler().addServletMapping(map);
        } finally {
            PathMap.setPathSpecSeparators(":,");
View Full Code Here

        holder.setClassName(HttpTunnelServlet.class.getName());
        servletHandler.setServlets(new ServletHolder[] {
            holder
        });

        ServletMapping mapping = new ServletMapping();
        mapping.setServletName("httpTunnel");
        mapping.setPathSpec("/*");
        servletHandler.setServletMappings(new ServletMapping[] {
            mapping
        });

        contextHandler.setAttribute("acceptListener", getAcceptListener());
View Full Code Here

    public void registerServletHolder(ServletHolder servletHolder, String servletName, Set<String> servletMappings, String objectName) throws Exception {
        webAppContext.getServletHandler().addServlet(servletHolder);
        if (servletMappings != null) {
            for (String urlPattern : servletMappings) {
                ServletMapping servletMapping = new ServletMapping();
                servletMapping.setPathSpec(urlPattern);
                servletMapping.setServletName(servletName);
                this.webAppContext.getServletHandler().addServletMapping(servletMapping);
            }
        }
        if (objectName != null) {
            synchronized (servletNames) {
View Full Code Here

     * @param node
     * @param context
     */
    public ServletMapping addServletMapping (String servletName, XmlParser.Node node, WebAppContext context, Descriptor descriptor)
    {
        ServletMapping mapping = new ServletMapping();
        mapping.setServletName(servletName);
        mapping.setDefault(descriptor instanceof DefaultsDescriptor);
       
        List<String> paths = new ArrayList<String>();
        Iterator<XmlParser.Node> iter = node.iterator("url-pattern");
        while (iter.hasNext())
        {
            String p = iter.next().toString(false, true);
            p = normalizePattern(p);
           
            //check if there is already a mapping for this path, and if there is && it is from a defaultdescriptor
            //remove it in favour of the new one     
            ListIterator<ServletMapping> listItor = _servletMappings.listIterator();
            boolean found = false;
            while (listItor.hasNext() && !found)
            {
                ServletMapping sm = listItor.next();
                if (sm.getPathSpecs() != null)
                {
                    for (String ps:sm.getPathSpecs())
                    {
                        if (p.equals(ps) && sm.isDefault())
                        {
                            if (LOG.isDebugEnabled()) LOG.debug("{} in mapping {} from defaults descriptor is overridden by ",ps,sm,servletName);
                            //remove ps from the path specs on the existing mapping
                            //if the mapping now has no pathspecs, remove it
                            String[] updatedPaths = ArrayUtil.removeFromArray(sm.getPathSpecs(), ps);
                            if (updatedPaths == null || updatedPaths.length == 0)
                            {
                                if (LOG.isDebugEnabled()) LOG.debug("Removed mapping {} from defaults descriptor",sm);
                                listItor.remove();
                            }
                            else
                            {
                                sm.setPathSpecs(updatedPaths);
                                if (LOG.isDebugEnabled()) LOG.debug("Removed path {} from mapping {} from defaults descriptor ", p,sm);
                            }
                            found = true;
                            break;
                        }
View Full Code Here

                jsp_pg_servlet=new ServletHolder(JspPropertyGroupServlet.NAME,new JspPropertyGroupServlet(context,handler));
                _servletHolderMap.put(JspPropertyGroupServlet.NAME,jsp_pg_servlet);
                _servletHolders.add(jsp_pg_servlet);
            }

            ServletMapping mapping = new ServletMapping();
            mapping.setServletName(JspPropertyGroupServlet.NAME);
            mapping.setPathSpecs(paths.toArray(new String[paths.size()]));
            _servletMappings.add(mapping);
        }
    }
View Full Code Here

        holders[0].setServletHandler(wac.getServletHandler());
        wac.getServletHandler().setServlets(holders);
        wac.setSecurityHandler(new ConstraintSecurityHandler());

        ServletMapping[] servletMappings = new ServletMapping[1];
        servletMappings[0] = new ServletMapping();

        servletMappings[0].setPathSpecs(paths);
        servletMappings[0].setServletName(servletName);
        wac.getServletHandler().setServletMappings(servletMappings);
        return wac;
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.servlet.ServletMapping

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.