java.lang.Object | |
↳ | org.springframework.web.util.UrlPathHelper |
Helper class for URL path matching. Provides support for URL paths in RequestDispatcher includes and support for consistent URL decoding.
Used by AbstractUrlHandlerMapping
,
AbstractUrlMethodNameResolver
and RequestContext
for path matching
and/or URI determination.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Decode the given source string with a URLDecoder.
| |||||||||||
Return the context path for the given request, detecting an include request
URL if called within a RequestDispatcher include.
| |||||||||||
Return the mapping lookup path for the given request, within the current
servlet mapping if applicable, else within the web application.
| |||||||||||
Return the context path for the given request, detecting an include request
URL if called within a RequestDispatcher include.
| |||||||||||
Return the query string part of the given request's URL.
| |||||||||||
Return the request URI for the given request.
| |||||||||||
Return the path within the web application for the given request.
| |||||||||||
Return the path within the servlet mapping for the given request,
i.e.
| |||||||||||
Return the request URI for the given request, detecting an include request
URL if called within a RequestDispatcher include.
| |||||||||||
Return the servlet path for the given request, regarding an include request
URL if called within a RequestDispatcher include.
| |||||||||||
Set if URL lookup should always use full path within current servlet
context.
| |||||||||||
Set the default character encoding to use for URL decoding.
| |||||||||||
Set if context path and request URI should be URL-decoded.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Determine the encoding for the given request.
| |||||||||||
Return the default character encoding to use for URL decoding.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Decode the given source string with a URLDecoder. The encoding will be taken from the request, falling back to the default "ISO-8859-1".
The default implementation uses URLDecoder.decode(input, enc)
.
request | current HTTP request |
---|---|
source | the String to decode |
Return the context path for the given request, detecting an include request URL if called within a RequestDispatcher include.
As the value returned by request.getContextPath()
is not
decoded by the servlet container, this method will decode it.
request | current HTTP request |
---|
Return the mapping lookup path for the given request, within the current servlet mapping if applicable, else within the web application.
Detects include request URL if called within a RequestDispatcher include.
request | current HTTP request |
---|
Return the context path for the given request, detecting an include request URL if called within a RequestDispatcher include.
As the value returned by request.getContextPath()
is not
decoded by the servlet container, this method will decode it.
request | current HTTP request |
---|
Return the query string part of the given request's URL. If this is a forwarded request, correctly resolves to the query string of the original request.
request | current HTTP request |
---|
Return the request URI for the given request. If this is a forwarded request, correctly resolves to the request URI of the original request.
Return the path within the web application for the given request.
Detects include request URL if called within a RequestDispatcher include.
request | current HTTP request |
---|
Return the path within the servlet mapping for the given request, i.e. the part of the request's URL beyond the part that called the servlet, or "" if the whole URL has been used to identify the servlet.
Detects include request URL if called within a RequestDispatcher include.
E.g.: servlet mapping = "/test/*"; request URI = "/test/a" -> "/a".
E.g.: servlet mapping = "/test"; request URI = "/test" -> "".
E.g.: servlet mapping = "/*.test"; request URI = "/a.test" -> "".
request | current HTTP request |
---|
Return the request URI for the given request, detecting an include request URL if called within a RequestDispatcher include.
As the value returned by request.getRequestURI()
is not
decoded by the servlet container, this method will decode it.
The URI that the web container resolves should be correct, but some containers like JBoss/Jetty incorrectly include ";" strings like ";jsessionid" in the URI. This method cuts off such incorrect appendices.
request | current HTTP request |
---|
Return the servlet path for the given request, regarding an include request URL if called within a RequestDispatcher include.
As the value returned by request.getServletPath()
is already
decoded by the servlet container, this method will not attempt to decode it.
request | current HTTP request |
---|
Set if URL lookup should always use full path within current servlet context. Else, the path within the current servlet mapping is used if applicable (i.e. in the case of a ".../*" servlet mapping in web.xml). Default is "false".
Set the default character encoding to use for URL decoding. Default is ISO-8859-1, according to the Servlet spec.
If the request specifies a character encoding itself, the request
encoding will override this setting. This also allows for generically
overriding the character encoding in a filter that invokes the
ServletRequest.setCharacterEncoding
method.
defaultEncoding | the character encoding to use |
---|
Set if context path and request URI should be URL-decoded. Both are returned undecoded by the Servlet API, in contrast to the servlet path.
Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).
Default is "true", as of Spring 2.5.
Determine the encoding for the given request. Can be overridden in subclasses.
The default implementation checks the request encoding, falling back to the default encoding specified for this resolver.
request | current HTTP request |
---|
null
)Return the default character encoding to use for URL decoding.