Returns servetPath without contextPath
196320
private String buildServletPath() {
    String uri = servletPath;
    if (uri == null && null != requestURI) {
      uri = requestURI;
      if (!contextPath.equals("/")) uri = uri.substring(contextPath.length());
    }
    return (null == uri) ? "" : uri;
  }
185575
private Set<String> findExclusionPaths() throws InitException {
       Set<String> exclusions = new TreeSet<String>();
       
       // Let other handlers deal with folders that do not reside in the WEB-INF or META-INF
       List<String> collect = null;
       File webapp = new File(deploymentInfo.getRealPath(""));
       String[] paths = webapp.list();
       if (webapp.exists() && paths != null)
           collect = Arrays.asList(paths);
       
       if (webapp.exists() && !webapp.canRead()) {
           // It means that the server cannot read files at all
           throw new InitException( HttpHandlerImpl.class.getName() + " cannot read files. Reason is unknown");
       } else if (!webapp.exists() || collect == null || collect.isEmpty()) {
           // Whenever this is empty it might just be because someone forgot to add the 'webapp' folder to the distribution
           // OR the framework is used without the need for serving files (such as views).
           logger.error("HttpHandlerImpl did not find any files in webapp - not serving any files then");
           return exclusions;
       }
       
       Set<String> resourcePaths = new TreeSet<>(collect);//servletContext.getResourcePaths("/");
       resourcePaths.removeIf( path -> path.contains("-INF") || path.contains("-inf"));
   
       // We still need to also remove the views folder from being processed by other handlers
       resourcePaths.removeIf( path -> path.contains(TemplateEngine.TEMPLATES_FOLDER));
       
       // Add the remaining paths to exclusions
       for (String path : resourcePaths) {
           // add leading slash
           if (path.charAt(0) != '/')
               path = '/' + path;
           
           // remove the last slash
           if (path.charAt(path.length()-1) == '/')
               path = path.substring(0, path.length()-1);
           exclusions.add(path);
       }
       
       return exclusions;
   }
1266566
@Override
	public String getResourcePath(String basePath, String relativePath) {

		String result = null;
		if (binaryGeneratorRegistry.isGeneratedBinaryResource(relativePath)) {
			result = relativePath;
		} else if (contextPath != null && relativePath.startsWith(contextPath)) {
			result = relativePath.substring(contextPath.length() - 1);
		} else {
			result = PathNormalizer.concatWebPath(basePath, relativePath);
		}
		return result;
	}
30817
@Override
    public String getPath() {
        final String fullPath = request.getRequestURI();
        // it shouldn't be null, but in case it is, it's better to return empty string
        if (fullPath == null) {
            return "";
        }
        final String context = request.getContextPath();
        // this one shouldn't be null either, but in case it is, then let's consider it is empty
        if (context != null) {
            return fullPath.substring(context.length());
        }
        return fullPath;
    }
573475
def api_url(self):
        ''''''
        return pathjoin(Bin.path, self.name, url=self.service.url)
1228924
function getBindPath(serverless, servicePath) {
  // Determine bind path
  if (process.platform !== 'win32' && !isWsl) {
    return servicePath;
  }

  // test docker is available
  dockerCommand(['version']);

  // find good bind path for Windows
  let bindPaths = [];
  let baseBindPath = servicePath.replace(/\\([^\s])/g, '/$1');
  let drive;
  let path;

  bindPaths.push(baseBindPath);
  if (baseBindPath.startsWith('/mnt/')) {
    // cygwin "/mnt/C/users/..."
    baseBindPath = baseBindPath.replace(/^\/mnt\//, '/');
  }
  if (baseBindPath[1] == ':') {
    // normal windows "c:/users/..."
    drive = baseBindPath[0];
    path = baseBindPath.substring(3);
  } else if (baseBindPath[0] == '/' && baseBindPath[2] == '/') {
    // gitbash "/c/users/..."
    drive = baseBindPath[1];
    path = baseBindPath.substring(3);
  } else {
    throw new Error(`Unknown path format ${baseBindPath.substr(10)}...`);
  }

  bindPaths.push(`/${drive.toLowerCase()}/${path}`); // Docker Toolbox (seems like Docker for Windows can support this too)
  bindPaths.push(`${drive.toLowerCase()}:/${path}`); // Docker for Windows
  // other options just in case
  bindPaths.push(`/${drive.toUpperCase()}/${path}`);
  bindPaths.push(`/mnt/${drive.toLowerCase()}/${path}`);
  bindPaths.push(`/mnt/${drive.toUpperCase()}/${path}`);
  bindPaths.push(`${drive.toUpperCase()}:/${path}`);

  const testFile = findTestFile(servicePath);

  for (let i = 0; i < bindPaths.length; i++) {
    const bindPath = bindPaths[i];
    if (tryBindPath(serverless, bindPath, testFile)) {
      return bindPath;
    }
  }

  throw new Error('Unable to find good bind path format');
}
1004222
public static String makeServicePath(String serviceName) {
        checkNotNull(serviceName);
        checkArgument(!"".equals(serviceName));
        return ZKPaths.makePath(ROOT_SERVICES_PATH, serviceName);
    }
28772
public static final String getRequestUriWithoutContextPath(HttpServletRequest request) {
        String uri = request.getRequestURI().substring(request.getContextPath().length());
        if (!uri.isEmpty()) {
            return uri;
        } else {
            return "/";
        }
    }
600378
public ServerConfig setContextPath(String contextPath) {
        if (!contextPath.endsWith(StringUtils.CONTEXT_SEP)) {
            contextPath += StringUtils.CONTEXT_SEP;
        }
        this.contextPath = contextPath;
        return this;
    }
238107
function getConfiguredPath (path) {
    if (options.useBasePath && context.api && context.api.basePath) {
      return context.api.basePath + path;
    }
    else {
      return path;
    }
  }
465999
function getPath( req, res, next ) {

	var path = req.path.replace( /\..*$/, '' ).replace( /\//g, '.' ).replace( /^\.conf/, '' ).replace( /\.$/, '' ).trim();

	if ( path.length < 1 ) {
		path = null;
	}

	var outputFilter = req.path.trim().match( /\.(.*)$/ );
	if ( outputFilter ) {
		outputFilter = outputFilter[1].trim();
	}

	if ( typeof outputFilter !== 'string' || outputFilter.length < 1 ) {
		outputFilter = 'json';
	}

	req.confPath = path;
	req.outputFilter = outputFilter;

	return next();

}
592773
def tomcat_base(broker):
        """"""
        ps = broker[DefaultSpecs.ps_auxww].content
        results = []
        findall = re.compile(r"\-Dcatalina\.base=(\S+)").findall
        for p in ps:
            found = findall(p)
            if found:
                # Only get the path which is absolute
                results.extend(f for f in found if f[0] == '/')
        return list(set(results))
1245612
def _get_directory_path(context):
    """"""
    path = os.path.join(settings.BASE_PATH, 'store')
    path = context.params.get('path', path)
    path = os.path.join(path, context.crawler.name)
    path = os.path.abspath(os.path.expandvars(path))
    try:
        os.makedirs(path)
    except Exception:
        pass
    return path
885008
@VisibleForTesting
    public FedoraResource getResourceFromPath(final String externalPath) {
        final Resource resource = translator().toDomain(externalPath);
        final FedoraResource fedoraResource = translator().convert(resource);

        if (fedoraResource instanceof Tombstone) {
            final String resourceURI = TRAILING_SLASH_REGEX.matcher(resource.getURI()).replaceAll("");
            throw new TombstoneException(fedoraResource, resourceURI + "/fcr:tombstone");
        }

        return fedoraResource;
    }
1059349
def validate_path_to_api_path(path, paths, basePath='', context=None, **kwargs):
    
    if context is None:
        context = {}
    try:
        api_path = match_path_to_api_path(
            path_definitions=paths,
            target_path=path,
            base_path=basePath,
            context=context,
        )
    except LookupError as err:
        raise ValidationError(str(err))
    except MultiplePathsFound as err:
        raise ValidationError(str(err))

    return api_path
315209
private String getServletPath(final String relativePath) {

		if (relativePath == null) {
			LOG.error("relativePath must not be null");
		}

		String context = getHostFreeBaseUrl();

		if (!Util.empty(context)) {
			return context + relativePath;
		}

		return relativePath;
	}
138340
function pathParse(fullPath){

    var parsedPath = {
        ext: path.extname(fullPath),
        dir: path.dirname(fullPath),
        full: fullPath,
        base:  path.basename(fullPath),
    };

    parsedPath.name = path.basename(fullPath, parsedPath.ext);

    return parsedPath;
}