Class MockPathResolver

java.lang.Object
org.apache.juneau.rest.mock.MockPathResolver

public class MockPathResolver extends Object
Used to resolve incoming URLS to the various URL artifacts of HttpServletRequest.
See Also:
  • Constructor Details

    • MockPathResolver

      public MockPathResolver(String target, String contextPath, String servletPath, String pathToResolve, Map<String,Object> pathVars)
      Constructor.
      Parameters:
      target - The target portion of the URL (e.g. "http://localhost").
      If null, "http://localhost" is assumed.
      contextPath - The context path of the servlet, or null if unknown or doesn't have one.
      servletPath - The servlet path of the servlet, or null if unknown or doesn't have one.
      pathToResolve - The path to resolve.
      Can be relative to servlet or an absolute path.
      pathVars - Optional path variables to resolve in the context path or servlet path.
  • Method Details

    • getContextPath

      Returns the context path of the URL.
      Returns:
      The context path of the URL always starting with '/', or an empty string if it doesn't exist.
    • getError

      public String getError()
      Returns any parsing errors.
      Returns:
      Any parsing errors, or null if parsing was successful.
    • getRemainder

      public String getRemainder()
      Returns the remainder of the URL following the context and servlet paths.
      Returns:
      The remainder of the URL.
    • getServletPath

      Returns the servlet path of the URL.
      Returns:
      The servlet path of the URL always starting with '/', or an empty string if it doesn't exist.
    • getTarget

      public String getTarget()
      Returns just the hostname portion of the URL.
      Returns:
      The hostname portion of the URL.
    • getURI

      public String getURI()
      Returns the fully-qualified URL.
      Returns:
      The fully-qualified URL.
    • properties

    • toString

      public String toString()
      Overrides:
      toString in class Object