Class RequestPath


  • public class RequestPath
    extends Object
    Represents the "path" portion of an HTTP request (as returned by HttpServletRequest.getPathInfo()). Includes utility methods for breaking the path down into its "head" (first component) and "tail" (remainder of the path without the head).
    • Constructor Detail

      • RequestPath

        public RequestPath​(String pathInfo)
    • Method Detail

      • getRelativePath

        public String getRelativePath()
        Returns the full path without any leading "/" character.
      • getHead

        public String getHead()
        Returns the first component of the path. Does not include any leading or trailing "/" character.
      • getTail

        public String getTail()
        Returns the remainder of the path after removing the first component. Does not include a leading "/" character. Returns an empty string if the path contains only a single component.
      • subPath

        public String subPath​(int from)
        Returns the subpath starting at the specified segment (zero-based) and extending to the end of the path.
      • getSegmentCount

        public int getSegmentCount()
        Returns the number of non-empty segments in the path.
      • getSegment

        public String getSegment​(int i)
        Returns the specified zero-based path segment, or an empty string if that segment doesn't exist.