Map a servlet to a pathSpec
@param pathSpec The pathspec to map
@param servletName The name of the servlet, which must have already been added.
@return The servlet holder of the mapped servlet.
544654
public ServletHolder mapPathToServlet(String pathSpec,
                                          String servletName)
    {
        ServletHolder holder =(ServletHolder)_nameMap.get(servletName);

        if (!pathSpec.startsWith("/") && !pathSpec.startsWith("*"))
        {
            log.warn("pathSpec should start with '/' or '*' : "+pathSpec);
            pathSpec="/"+pathSpec;
        }
        
        if (holder==null)
            throw new IllegalArgumentException("Unknown servlet: "+servletName);
        _servletMap.put(pathSpec,holder);
        return holder;
    }
526806
public void visit(final WebAppServlet webAppServlet) {
		NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
		final String[] urlPatterns = webAppServlet.getAliases();
		if (urlPatterns == null || urlPatterns.length == 0) {
			LOG.warn("Servlet [" + webAppServlet
					+ "] does not have any mapping. Skipped.");
		}
		try {
			if (webAppServlet instanceof WebAppJspServlet) {
				webContainer.registerJspServlet(urlPatterns, httpContext,
						((WebAppJspServlet) webAppServlet).getJspPath());
			} else {
				Class<? extends Servlet> servletClass = RegisterWebAppVisitorHS
						.loadClass(Servlet.class, bundleClassLoader,
								webAppServlet.getServletClassName());
				webContainer.registerServlet(servletClass, urlPatterns,
						RegisterWebAppVisitorHS.convertInitParams(webAppServlet
								.getInitParams()), webAppServlet
								.getLoadOnStartup(), webAppServlet
								.getAsyncSupported(), webAppServlet.getMultipartConfig()
						, httpContext);
			}
			//CHECKSTYLE:OFF
		} catch (Exception ignore) {
			LOG.error(REGISTRATION_EXCEPTION_SKIPPING, ignore);
		}
		//CHECKSTYLE:ON
	}
1080691
public void addServlet(String name, String pathSpec,
      Class<? extends HttpServlet> clazz) {
    addInternalServlet(name, pathSpec, clazz);
    addFilterPathMapping(pathSpec, webAppContext);
  }
643747
public ServletHolder[] getServlets()
    {
        // Sort and Initialize servlets
        HashSet holder_set = new HashSet(_nameMap.size());
        holder_set.addAll(_nameMap.values());
        ServletHolder holders [] = (ServletHolder [])
            holder_set.toArray(new ServletHolder [holder_set.size()]);
        java.util.Arrays.sort (holders);
        return holders;
    }
1242513
def search_servlet(path)
      script_name, path_info = @mount_tab.scan(path)
      servlet, options = @mount_tab[script_name]
      if servlet
        [ servlet, options, script_name, path_info ]
      end
    end
704234
private void processURLPatterns(List<ServletMapping> servletMappings) {
        for (ServletMapping servletMapping : servletMappings) {
            String servletName = servletMapping.getServletName();
            List<String> urlPatterns = servletMapping.getURLPatterns();
            if (urlPatterns != null) {
                for (String pattern : urlPatterns) {
                    urlPatternToServletName.put(pattern, servletName);
                }
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "urlPatternToServletName: " + urlPatternToServletName);
        }
    }
972681
private ServletHolder getServletHolder(MuleAgentConfig pConfig) {
        ServletHolder holder = new ServletHolder(new AgentServlet());
        holder.setInitParameters(getInitParameters(pConfig));
        holder.setInitOrder(1);
        return holder;
    }
246078
public IServletConfig getServletInfo(String string) {
        if (string == null || string.isEmpty()){
            Tr.debug(tc, "getServletInfo", "servlet name is null/empty. Use internal servlet name " + NULLSERVLETNAME);
            string = NULLSERVLETNAME;
        }

        return (IServletConfig) this.servletInfo.get(string);
    }
1003264
public void addServletHolder(ServletHolder holder)
    {
        ServletHolder existing = (ServletHolder)
        _nameMap.get(holder.getName());
        if (existing==null)
            _nameMap.put(holder.getName(),holder);
        else if (existing!=holder)
            throw new IllegalArgumentException("Holder already exists for name: "+holder.getName());
        addComponent(holder);
    }
967791
public static FacesServletMapping createPrefixMapping(String path)
    {
        FacesServletMapping mapping = new FacesServletMapping();
        mapping.setPrefix(path);
        return mapping;
    }
971534
@Override
  public PathImpl getPath(String name)
  {
    if (_prefix != null && _pathPrefix == null)
      _pathPrefix = _prefix.replace('.', '/');

    if (_pathPrefix != null && ! name.startsWith(_pathPrefix))
      return null;

    if (name.startsWith("/"))
      return _path.lookup("." + name);
    else
      return _path.lookup(name);
  }
1095957
public static String pathMatch(String pathSpec, String path)
    {  
        char c = pathSpec.charAt(0);
        
        if (c=='/')
        {
            if (pathSpec.length()==1)
                return path;
        
            if (pathSpec.equals(path))
                return path;
            
            if (pathSpec.endsWith("/*") &&
                pathSpec.regionMatches(0,path,0,pathSpec.length()-2))
                return path.substring(0,pathSpec.length()-2);
            
            if (path.startsWith(pathSpec) && path.charAt(pathSpec.length())==';')
                return path;
        }
        else if (c=='*')
        {
            if (path.regionMatches(path.length()-(pathSpec.length()-1),
                                   pathSpec,1,pathSpec.length()-1))
                return path;
        }
        return null;
    }
1076891
public static UrlMappingsHolder lookupUrlMappings(ServletContext servletContext) {
        WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
        return (UrlMappingsHolder)wac.getBean(UrlMappingsHolder.BEAN_ID);
    }
469509
@Override
	public void registerServlet(final String alias, final Servlet servlet,
								@SuppressWarnings("rawtypes") final Dictionary initParams,
								final HttpContext httpContext) throws ServletException,
			NamespaceException {
		synchronized (lock) {
			this.registerServlet(alias, servlet, initParams, null, null,
					httpContext);
		}
	}
278208
public static String getServletParameter(Servlet servlet, String name, Set<GetOpts> opts, String defaultValue)
	{
		return getServletParameter(servlet.getServletConfig(), name, opts, defaultValue);
	}
472787
public final PathImpl lookup(URL url)
  {
    String name = URLDecoder.decode(url.toString());

    return lookup(name, null);
  }
677775
public String[] getPaths()
    {
        ServletHandler handler = (ServletHandler)_holder.getHttpHandler();
        Map servletMap = handler.getServletMap();
        ArrayList paths = new ArrayList(servletMap.size());
        Iterator iter = servletMap.entrySet().iterator();
        while (iter.hasNext())
        {
            Map.Entry entry =(Map.Entry)iter.next();
            if (entry.getValue()==_holder)
                paths.add(entry.getKey());
        }
        return (String[])paths.toArray(new String[paths.size()]);
    }