Parse a API request path from servlet path info.
@param pathInfo
@return the path info parsed into its component parts
4803
protected static final ApiRequestPathInfo parseApiRequestPath(HttpServletRequest request) {
        return ApimanPathUtils.parseApiRequestPath(request.getHeader(ApimanPathUtils.X_API_VERSION_HEADER),
                request.getHeader(ApimanPathUtils.ACCEPT_HEADER),
                request.getPathInfo());
    }
855223
private function getUriFromBaseUrl($pathinfo)
    {
        $request = $this->application->getRequest();
        if (basename($request->getBaseUrl()) === basename($request->server->get('SCRIPT_NAME'))) {
            return $request->getSchemeAndHttpHost()
                    . substr($request->getBaseUrl(), 0, -1 * (1 + strlen(basename($request->getBaseUrl()))))
                    . $pathinfo;
        } else {
            return $request->getUriForPath($pathinfo);
        }
    }
1171684
private WebResource getResource(WebResource service, APIInfo api, String... pathParams) {
        WebResource resource = service.path(api.getPath());
        resource = appendPathParams(resource, pathParams);
        return resource;
    }
907770
@Override
    public String getPathTranslated() {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getPathTranslated();
        } finally {
            collaborator.postInvoke();
        }
    }
1979
public String getPathTranslated()
    {
        String pathInfo = getPathInfo();

        if (pathInfo == null)
        {
            return null;
        }
        else
        {
            return getWebApp().getRealPath(pathInfo);
        }
    }
898430
private static String extractPathInfo(String pPathInfo, ProcessingParameters pProcessingParams) {
        String pathInfo = pPathInfo;

        // If no pathinfo is given directly, we look for a query parameter named 'p'.
        // This variant is helpful, if there are problems with the server mangling
        // up the pathinfo (e.g. for security concerns, often '/','\',';' and other are not
        // allowed in encoded form within the pathinfo)
        if (pProcessingParams != null && (pPathInfo == null || pPathInfo.length() == 0 || pathInfo.matches("^/+$"))) {
            pathInfo = pProcessingParams.getPathInfo();
        }
        return normalizePathInfo(pathInfo);
    }
962422
public ManagedArtifact getArtifact(String pathInfo) {
        LOGGER.entering();
        ManagedArtifact managedArtifact = serverRepository.getArtifact(pathInfo);
        LOGGER.exiting(managedArtifact);
        return managedArtifact;
    }
715704
protected String getRelativePath( HttpServletRequest request ) {

        // Are we being processed by a RequestDispatcher.include()?
        if (request.getAttribute("javax.servlet.include.request_uri") != null) {
            String result = (String)request.getAttribute("javax.servlet.include.path_info");
            // if (result == null)
            // result = (String) request
            // .getAttribute("javax.servlet.include.servlet_path");
            if ((result == null) || (result.equals(""))) {
                result = "/";
            }
            return result;
        }

        // No, extract the desired path directly from the request
        String result = request.getPathInfo();

        if ((result == null) || (result.equals(""))) {
            result = "/";
        }
        return result;
    }
807482
public static BeanPathProperties parsePathProperties() {
        Object pathProperties = Requests.getProperty(PATH_PROPS_PARSED);
        if (pathProperties == null) {
            String fields = parseQueryFields();
            if (fields != null) {
                pathProperties = BeanPathProperties.parse(fields);
                Requests.setProperty(PATH_PROPS_PARSED, pathProperties);
            } else {
                Requests.setProperty(PATH_PROPS_PARSED, false);
            }
        } else if (pathProperties.equals(false)) {
            return null;
        }
        return (BeanPathProperties) pathProperties;
    }
1052464
public void setPathElements(String servletPath, String pathInfo)
    {
        ((SRTServletRequest)_request).resetPathElements();

        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) {    //PI67942
            logger.logp(Level.FINE, CLASS_NAME,"setPathElements", "servletPath = " + servletPath +", pathInfo = " + pathInfo +" : this = " + this);
        }
        //PK39337 - start
        if (removeServletPathSlash) {

            boolean hasSlashStar = false;
            boolean isPossible = isPossibleSlashStarMapping();
            if (isPossible) {
                hasSlashStar = hasSlashStarMapping();
            }

            if(hasSlashStar) {
                this._servletPath = "";
                if (servletPath == null) {
                    this._pathInfo = pathInfo;
                } else if (pathInfo == null) {
                    this._pathInfo = servletPath;
                } else {
                    this._pathInfo = servletPath + pathInfo;
                }
            }
            else if (isPossible) {
                //this means that it probably used the mapping '/'
                //so the servlet path can't be null or and empty string.
                if (servletPath == null || servletPath.equals("")) {
                    this._servletPath = pathInfo;
                    this._pathInfo = null;
                }
                else {
                    this._servletPath = servletPath;
                    this._pathInfo = pathInfo;
                }
            }
            else {
                this._servletPath = servletPath;
                this._pathInfo = pathInfo;
            }

            if ((_servletPath != null) && (_servletPath.length() > 1 && _servletPath.endsWith("/"))) {
                this._servletPath = _servletPath.substring(0, (_servletPath.length() - 1));
                if (_pathInfo ==null)
                    this._pathInfo = "/";
                else
                    this._pathInfo = "/"+ _pathInfo;
            }       		
        }
        //PK39337 - end
        else if (servletPath.length()==1 && servletPath.charAt(0)=='/' && !Boolean.valueOf(WCCustomProperties.SERVLET_PATH_FOR_DEFAULT_MAPPING).booleanValue()) {
            this._servletPath = "";
            if (pathInfo ==null)
                this._pathInfo = "/";
            else
                this._pathInfo = "/"+ pathInfo;
        }
        else {
            this._servletPath = servletPath;
            this._pathInfo = pathInfo;
        }

        this.relativeUri = _servletPath;

        if (_pathInfo != null)
            relativeUri += _pathInfo;
        
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) { 
            logger.logp(Level.FINE, CLASS_NAME,"setPathElements", "returns with servletPath = " + _servletPath +", pathInfo = " + _pathInfo +" : this = " + this);
        }
        
    }
340063
public static URI getUri(UriInfo uriInfo,
                             HttpServletRequest req,
                             String path) {
        String suffix = "";
        if (req.getRequestURI().endsWith(".json")) {
            suffix = ".json";
        } else if (req.getRequestURI().endsWith(".xml")) {
            suffix = ".xml";
        }
        return URI.create(uriInfo.getBaseUri() + "/" + path + suffix);
    }
431965
public String getApiPath(String path) {
        String apiPath = getApiEndpoint() + path;

        if (!apiPath.endsWith("/")) {
            apiPath += Character.toString('/');
        }
        return apiPath;
    }
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;

	}
1269603
@Override
   public String getTrimmedPath(String path)
   {
      if (path == null)
      {
         return "/";
      }
      if (!path.startsWith("/"))
      {
         try
         {
            path = new URL(path).getPath();
         }
         catch (MalformedURLException ex)
         {
            // ignore
            Logger.getLogger(JBossWSDestinationRegistryImpl.class).trace(ex);
         }
         if (!path.startsWith("/")) {
            path = "/" + path;
         }
      }
      return path;
   }
46090
public PropertyPath parse(final String path) {
        
        ArgUtils.notEmpty(path, "path");
        
        final PropertyPath tokenStore = new PropertyPath(path);
        splitToken(tokenStore, path);
        return tokenStore;
    }
948453
private static String getHandler(HttpServletRequest request) {
    String pathInfo = request.getPathInfo();
    return pathInfo == null ? "" : pathInfo.substring(1);
  }
618409
function parsePath(req) {
  // get path if preprocessed or otherwise separate path from query string
  const path = req.path || (req.url && req.url.split('?')[0]) || '';
  // ignore start and end slashes, and split the path
  return path.replace(/^\/|\/$/g, '').split('/');
}