Add the path spec to the filter path mapping.
@param pathSpec The path spec
@param webAppCtx The WebApplicationContext to add to
556712
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);
    }
  }
669696
private static void addEntries(Bundle bundle, String path,
			String filePattern, List<URL> pathList) {
		Enumeration<?> e = bundle.findEntries(path, filePattern, false);
		while (e != null && e.hasMoreElements()) {
			URL u = (URL) e.nextElement();
			pathList.add(u);
		}
	}
881867
@Autowired
    public void setCtx(ApplicationContext _ctx) {
        // in lambda we need to start up the CTX ourselves
        // for unit tests and REST, all the autowiring should happen automatically
        if (LambdaSpringUtil.ctx == null) {
            LambdaSpringUtil.ctx = _ctx;
        }
    }
978186
private static void appendLocatorXPath(StringBuilder builder, String locatorName, WebLocator locator, boolean compact) {
        String path = locator.getXPath();
        String xpathLocatorVar = "xpath_" + locatorName;
        String newLine = compact ? "" : "\n";
        builder.append("var ").append(xpathLocatorVar).append("Path = \"").append(path).append("\";").append(newLine);
        builder.append("var ").append(xpathLocatorVar).append(" = $x(").append(xpathLocatorVar).append("Path);").append(newLine);
        builder.append("if (").append(xpathLocatorVar).append("[0]) {").append(newLine);
        builder.append("  console.info('").append(locatorName).append("', ").append(xpathLocatorVar).append("[0]);").append(newLine);
        builder.append("  if (").append(xpathLocatorVar).append(".length > 1) console.warn('  found more elements', ").append(xpathLocatorVar).append(");").append(newLine);
        builder.append("} else {").append(newLine);
        builder.append("  console.error('").append(locatorName).append("', ' - not found!');").append(newLine);
        builder.append("  console.warn(\"  \"+").append(xpathLocatorVar).append("Path);").append(newLine);
        builder.append("}").append(newLine).append(newLine);
    }
591244
private void findPath(Map<Spec, SpecExecutor> specExecutorInstanceMap, Spec spec) {
    inMemoryWeightGraphGenerator();
    FlowSpec flowSpec = (FlowSpec) spec;
    if (optionalUserSpecifiedPath.isPresent()) {
      log.info("Starting to evaluate user's specified path ... ");
      if (userSpecifiedPathVerificator(specExecutorInstanceMap, flowSpec)) {
        log.info("User specified path[ " + optionalUserSpecifiedPath.get() + "] successfully verified.");
        return;
      } else {
        log.error("Will not execute user specified path[ " + optionalUserSpecifiedPath.get() + "]");
        log.info("Start to execute FlowCompiler's algorithm for valid data movement path");
      }
    }

    ServiceNode sourceNode =
        new BaseServiceNodeImpl(flowSpec.getConfig().getString(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY));

    ServiceNode targetNode =
        new BaseServiceNodeImpl(flowSpec.getConfig().getString(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY));

    List<FlowEdge> resultEdgePath = dijkstraBasedPathFindingHelper(sourceNode, targetNode, this.weightedGraph);
    for (int i = 0; i < resultEdgePath.size() ; i++) {
      FlowEdge tmpFlowEdge = resultEdgePath.get(i);
      ServiceNode edgeSrcNode = ((LoadBasedFlowEdgeImpl) tmpFlowEdge).getSourceNode();
      ServiceNode edgeTgtNode = ((LoadBasedFlowEdgeImpl) tmpFlowEdge).getTargetNode();
      specExecutorInstanceMap.put(convertHopToJobSpec(edgeSrcNode, edgeTgtNode, flowSpec),
          ((LoadBasedFlowEdgeImpl) (resultEdgePath.get(i))).getSpecExecutorInstance());
    }
  }
1139224
public static void path(@NotNull String path, @NotNull EndpointGroup endpointGroup) {
        path = path.startsWith("/") ? path : "/" + path;
        pathDeque.addLast(path);
        endpointGroup.addEndpoints();
        pathDeque.removeLast();
    }
117532
public void setAuxAnalyzepath(Path src) {
        boolean nonEmpty = false;

        String[] elementList = src.list();
        for (String anElementList : elementList) {
            if (!"".equals(anElementList)) {
                nonEmpty = true;
                break;
            }
        }

        if (nonEmpty) {
            if (auxAnalyzepath == null) {
                auxAnalyzepath = src;
            } else {
                auxAnalyzepath.append(src);
            }
        }
    }
1120791
private void loadWebConfigs(Environment environment, SpringConfiguration config, ApplicationContext appCtx) throws ClassNotFoundException {
        // Load filters.
        loadFilters(config.getFilters(), environment);

        // Load servlet listener.
        environment.servlets().addServletListeners(new RestContextLoaderListener((XmlRestWebApplicationContext) appCtx));

        // Load servlets.
        loadServlets(config.getServlets(), environment);
    }
741366
function addSpecFiles() {
        const specFiles = {};
        for (const spec in filters.specs) {
            specFiles[parseResults.specs.specTable[spec].specFile] = true;
        }
        filters.specFiles = specFiles;
    }
198134
private static void addPathChain(PathChain pathChain) {
		HttpString method = new HttpString(pathChain.getMethod());

		// Use a random integer as the id for a given path.
		Integer randInt = new Random().nextInt();
		while (handlerListById.containsKey(randInt.toString())) {
			randInt = new Random().nextInt();
		}

		// Flatten out the execution list from a mix of middleware chains and handlers.
		List<HttpHandler> handlers = getHandlersFromExecList(pathChain.getExec());
		if(handlers.size() > 0) {
			// If a matcher already exists for the given type, at to that instead of
			// creating a new one.
			PathTemplateMatcher<String> pathTemplateMatcher = methodToMatcherMap.containsKey(method)
				? methodToMatcherMap.get(method)
				: new PathTemplateMatcher<>();

			if(pathTemplateMatcher.get(pathChain.getPath()) == null) { pathTemplateMatcher.add(pathChain.getPath(), randInt.toString()); }
			methodToMatcherMap.put(method, pathTemplateMatcher);
			handlerListById.put(randInt.toString(), handlers);
		}
	}
1320199
public synchronized Object put(Object pathSpec, Object object)
    {
        StringTokenizer tok = new StringTokenizer(pathSpec.toString(),__pathSpecSeparators);
        Object old =null;
        
        while (tok.hasMoreTokens())
        {
            String spec=tok.nextToken();
            
            if (!spec.startsWith("/") && !spec.startsWith("*."))
            {
                log.warn("PathSpec "+spec+". must start with '/' or '*.'");
                spec="/"+spec;
            }
            
            old = super.put(spec,object);
            
            // Make entry that was just created.
            Entry entry = new Entry(spec,object);

            if (entry.getKey().equals(spec))
            {
                if (spec.equals("/*"))
                    _prefixDefault=entry;
                else if (spec.endsWith("/*"))
                {
                    _prefixMap.put(spec.substring(0,spec.length()-2),entry);
                    _exactMap.put(spec.substring(0,spec.length()-1),entry);
                    _exactMap.put(spec.substring(0,spec.length()-2),entry);
                }
                else if (spec.startsWith("*."))
                    _suffixMap.put(spec.substring(2),entry);
                else if (spec.equals("/"))
                {    
                    if (_nodefault)
                        _exactMap.put(spec,entry);
                    else
                    {
                        _default=entry;
                        _defaultSingletonList=
                            SingletonList.newSingletonList(_default);
                    }
                }
                else
                    _exactMap.put(spec,entry);
            }
        }
            
        return old;
    }
261862
public void filterPaths(PathImpl path, String prefix, PathCallback cb)
  {
    if (! path.exists() || ! path.canRead()) {
      return;
    }
    
    if (! isValidPrefix(path, prefix)) {
      return;
    }
    
    if (path.isDirectory()) {
      try {
        String []list = path.list();

        for (int i = 0; i < list.length; i++) {
          String name = list[i];
          
          if (".".equals(name) || "..".equals(name))
            continue;
          
          // jsp/187j
          PathImpl subpath = path.lookup("./" + name);
          
          filterPaths(subpath, prefix, cb);
        }
      } catch (IOException e) {
        log.log(Level.WARNING, e.toString(), e);
      }
    }
    
    if (path.exists()) {
      // server/2438 - logging on unreadable
      //  if (path.canRead()) {
      if (isMatch(path, prefix)) {
        String suffix = "";
        String fullPath = path.getPath();

        if (prefix.length() < fullPath.length())
          suffix = path.getPath().substring(prefix.length());

        path.setUserPath(_userPathPrefix + suffix);

        cb.onMatch(path);
      }
    }
  }
1079707
public static List<Resource> parsePath(final SecurityContext securityContext, final HttpServletRequest request, final Map<Pattern, Class<? extends Resource>> resourceMap, final Value<String> propertyView) throws FrameworkException {

		final String path = request.getPathInfo();

		// intercept empty path and send 204 No Content
		if (StringUtils.isBlank(path)) {

			throw new NoResultsException("No content");
		}

		// 1.: split request path into URI parts
		final String[] pathParts = path.split("[/]+");

		// 2.: create container for resource constraints
		final Set<String> propertyViews    = Services.getInstance().getConfigurationProvider().getPropertyViews();
		final List<Resource> resourceChain = new ArrayList<>(pathParts.length);

		// 3.: try to assign resource constraints for each URI part
		for (int i = 0; i < pathParts.length; i++) {

			// eliminate empty strings
			final String part = pathParts[i].trim();

			if (part.length() > 0) {

				boolean found = false;

				// check views first
				if (propertyViews.contains(part)) {

					Resource resource = new ViewFilterResource();
					resource.checkAndConfigure(part, securityContext, request);
					resource.configurePropertyView(propertyView);

					resourceChain.add(resource);

					// mark this part as successfully parsed
					found = true;

				} else {

					// look for matching pattern
					for (Map.Entry<Pattern, Class<? extends Resource>> entry : resourceMap.entrySet()) {

						Pattern pattern = entry.getKey();
						Matcher matcher = pattern.matcher(pathParts[i]);

						if (matcher.matches()) {

							Class<? extends Resource> type = entry.getValue();
							Resource resource              = null;

							try {

								// instantiate resource constraint
								resource = type.newInstance();
							} catch (Throwable t) {

								logger.warn("Error instantiating resource class", t);

							}

							if (resource != null) {

								// set security context
								resource.setSecurityContext(securityContext);

								if (resource.checkAndConfigure(part, securityContext, request)) {

									logger.debug("{} matched, adding resource of type {} for part {}", new Object[] { matcher.pattern(), type.getName(),
										part });

									// allow constraint to modify context
									resource.configurePropertyView(propertyView);

									// add constraint and go on
									resourceChain.add(resource);

									found = true;

									// first match wins, so choose priority wisely ;)
									break;

								}
							}

						}
					}
				}

				if (!found) {

					throw new NotFoundException("Cannot resolve URL path");
				}

			}
		}

		return resourceChain;

	}
863802
public void insertPath(int pathIndex, MultiPathImpl src, int srcPathIndex,
			boolean bForward) {
		if (src == this)
			throw new IllegalArgumentException();

		if (srcPathIndex >= src.getPathCount())
			throw new IllegalArgumentException();

		int oldPathCount = getPathCount();
		if (pathIndex > oldPathCount)
			throw new IllegalArgumentException();

		if (pathIndex < 0)
			pathIndex = oldPathCount;

		if (srcPathIndex < 0)
			srcPathIndex = src.getPathCount() - 1;

		m_bPathStarted = false;

		mergeVertexDescription(src.m_description);// merge attributes from the
													// source

		src._verifyAllStreams();// the source need to be correct.

		int srcPathIndexStart = src.getPathStart(srcPathIndex);
		int srcPathSize = src.getPathSize(srcPathIndex);
		int oldPointCount = m_pointCount;
		int offset = src.isClosedPath(srcPathIndex) && !bForward ? 1 : 0;

		_resizeImpl(m_pointCount + srcPathSize);
		_verifyAllStreams();
		int pathIndexStart = pathIndex < oldPathCount ? getPathStart(pathIndex)
				: oldPointCount;

		// Copy all attribute values.
		for (int iattr = 0, nattr = m_description.getAttributeCount(); iattr < nattr; iattr++) {
			int semantics = m_description._getSemanticsImpl(iattr);
			int isrcAttr = src.m_description.getAttributeIndex(semantics);

			int comp = VertexDescription.getComponentCount(semantics);

			if (isrcAttr >= 0 && src.m_vertexAttributes[isrcAttr] != null) {
				if (offset != 0)
					m_vertexAttributes[iattr].insertRange(
							pathIndexStart * comp,
							src.m_vertexAttributes[isrcAttr], comp
									* srcPathIndexStart, comp, true, comp, comp
									* oldPointCount);
				m_vertexAttributes[iattr].insertRange((pathIndexStart + offset)
						* comp, src.m_vertexAttributes[isrcAttr], comp
						* (srcPathIndexStart + offset), comp
						* (srcPathSize - offset), bForward, comp, comp
						* (oldPointCount + offset));
			} else {
				// Need to make room for the attributes, so we copy default
				// values in

				double v = VertexDescription.getDefaultValue(semantics);
				m_vertexAttributes[iattr].insertRange(pathIndexStart * comp, v,
						comp * srcPathSize, comp * oldPointCount);
			}
		}

		int newPointCount = oldPointCount + srcPathSize;
		m_paths.add(newPointCount);

		for (int ipath = oldPathCount; ipath >= pathIndex + 1; ipath--) {
			int iend = m_paths.read(ipath - 1);
			m_paths.write(ipath, iend + srcPathSize);
		}

		// ========================== todo: NonLinearSegments =================
		if (src.hasNonLinearSegments(srcPathIndex)) {

		}

		m_pathFlags.add((byte) 0);

		// _ASSERT(m_pathFlags.size() == m_paths.size());

		for (int ipath = oldPathCount - 1; ipath >= pathIndex + 1; ipath--) {
			byte flags = m_pathFlags.read(ipath);
			flags &= ~(byte) PathFlags.enumCalcMask;// remove calculated flags
			m_pathFlags.write(ipath + 1, flags);
		}

		AttributeStreamOfInt8 srcPathFlags = src.getPathFlagsStreamRef();
		byte flags = srcPathFlags.read(srcPathIndex);
		flags &= ~(byte) PathFlags.enumCalcMask;// remove calculated flags

		if (m_bPolygon)
			flags |= (byte) PathFlags.enumClosed;

		m_pathFlags.write(pathIndex, flags);
	}
819461
public ServletHolder addServlet(String name,
                                    String pathSpec,
                                    String servletClass)
    {
        return addServlet(name,pathSpec,servletClass,null);
    }
865089
public void addListener(IWebSocketDataListener listener, String path) {
        log.trace("addListener: {}", listener);
        WebSocketScope scope = getScope(path);
        if (scope != null) {
            scope.addListener(listener);
        } else {
            log.info("Scope not found for path: {}", path);
        }
    }
60038
public synchronized Object remove(Object pathSpec)
    {
        if (pathSpec!=null)
        {
            String spec=(String) pathSpec;
            if (spec.equals("/*"))
                _prefixDefault=null;
            else if (spec.endsWith("/*"))
            {
                _prefixMap.remove(spec.substring(0,spec.length()-2));
                _exactMap.remove(spec.substring(0,spec.length()-1));
                _exactMap.remove(spec.substring(0,spec.length()-2));
            }
            else if (spec.startsWith("*."))
                _suffixMap.remove(spec.substring(2));
            else if (spec.equals("/"))
            {
                _default=null;
                _defaultSingletonList=null;
            }
            else
                _exactMap.remove(spec);
        }
        return super.remove(pathSpec);
    }