Interface RequestPath

All Superinterfaces:
PathContainer

public interface RequestPath extends PathContainer
Specialization of PathContainer that subdivides the path into a contextPath() and the remaining pathWithinApplication(). The latter is typically used for request mapping within the application while the former is useful when preparing external links that point back to the application.
Since:
5.0
Author:
Rossen Stoyanchev
  • Method Details

    • contextPath

      PathContainer contextPath()
      Returns the portion of the URL path that represents the application. The context path is always at the beginning of the path and starts but does not end with "/". It is shared for URLs of the same application.

      The context path may come from the underlying runtime API such as when deploying as a WAR to a Servlet container or it may be assigned in a WebFlux application through the use of ContextPathCompositeHandler.

    • pathWithinApplication

      PathContainer pathWithinApplication()
      The portion of the request path after the context path which is typically used for request mapping within the application.
    • modifyContextPath

      RequestPath modifyContextPath(String contextPath)
      Return a new RequestPath instance with a modified context path. The new context path must match 0 or more path segments at the start.
      Parameters:
      contextPath - the new context path
      Returns:
      a new RequestPath instance
    • parse

      static RequestPath parse(URI uri, @Nullable String contextPath)
      Parse the URI for a request into a RequestPath.
      Parameters:
      uri - the URI of the request
      contextPath - the contextPath portion of the URI path
    • parse

      static RequestPath parse(String rawPath, @Nullable String contextPath)
      Variant of parse(URI, String) with the encoded raw path.
      Parameters:
      rawPath - the path
      contextPath - the contextPath portion of the URI path
      Since:
      5.3