Top Description Methods
org.springframework.http.server

public Interface RequestPath

extends PathContainer
Known Direct Implementers
org.springframework.web.util.ServletRequestPathUtils.ServletRequestPath, org.springframework.http.server.DefaultRequestPath
Imports
java.net.URI, org.springframework.lang.Nullable

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.
Author
Rossen Stoyanchev
Since
5.0

Method Summary

Modifier and TypeMethod and Description
public PathContainer
contextPath()

Returns the portion of the URL path that represents the application.

public RequestPath

Returns:

a new RequestPath instance
modifyContextPath
(String
the new context path
contextPath
)

Return a new RequestPath instance with a modified context path.

public static RequestPath
parse(URI
the URI of the request
uri
,
String
the contextPath portion of the URI path
contextPath
)

Parse the URI for a request into a RequestPath.

public static RequestPath
parse(String
the path
rawPath
,
String
the contextPath portion of the URI path
contextPath
)

Variant of parse(URI, String) with the encoded raw path.

public PathContainer
pathWithinApplication()

The portion of the request path after the context path which is typically used for request mapping within the application.

Inherited from org.springframework.http.server.PathContainer:
elementsparsePathparsePathsubPathsubPathvalue

Method Detail

contextPathback to summary
public 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.

modifyContextPathback to summary
public 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:String

the new context path

Returns:RequestPath

a new RequestPath instance

parseback to summary
public static RequestPath parse(URI uri, String contextPath)

Parse the URI for a request into a RequestPath.

Parameters
uri:URI

the URI of the request

contextPath:String

the contextPath portion of the URI path

parseback to summary
public static RequestPath parse(String rawPath, String contextPath)

Variant of parse(URI, String) with the encoded raw path.

Parameters
rawPath:String

the path

contextPath:String

the contextPath portion of the URI path

Since
5.3
pathWithinApplicationback to summary
public PathContainer pathWithinApplication()

The portion of the request path after the context path which is typically used for request mapping within the application.