| java.lang.Object org.springframework.web.util.UrlPathHelper
UrlPathHelper | public class UrlPathHelper (Code) | | Helper class for URL path matching. Provides support for URL paths in
RequestDispatcher includes and support for consistent URL decoding.
Used by
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping ,
org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver and
org.springframework.web.servlet.support.RequestContext for path matching
and/or URI determination.
author: Juergen Hoeller author: Rob Harrop since: 14.01.2004 |
Method Summary | |
public String | decodeRequestString(HttpServletRequest request, String source) Decode the given source string with a URLDecoder. | protected String | determineEncoding(HttpServletRequest request) Determine the encoding for the given request. | public String | getContextPath(HttpServletRequest request) Return the context path for the given request, detecting an include request
URL if called within a RequestDispatcher include. | protected String | getDefaultEncoding() Return the default character encoding to use for URL decoding. | public String | getLookupPathForRequest(HttpServletRequest request) Return the mapping lookup path for the given request, within the current
servlet mapping if applicable, else within the web application. | public String | getOriginatingContextPath(HttpServletRequest request) Return the context path for the given request, detecting an include request
URL if called within a RequestDispatcher include. | public String | getOriginatingQueryString(HttpServletRequest request) Return the request URI for root of the given request. | public String | getOriginatingRequestUri(HttpServletRequest request) Return the request URI for root of the given request. | public String | getPathWithinApplication(HttpServletRequest request) Return the path within the web application for the given request. | public String | getPathWithinServletMapping(HttpServletRequest request) Return the path within the servlet mapping for the given request,
i.e. | public String | getRequestUri(HttpServletRequest 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. | public String | getServletPath(HttpServletRequest request) Return the servlet path for the given request, regarding an include request
URL if called within a RequestDispatcher include. | public void | setAlwaysUseFullPath(boolean alwaysUseFullPath) Set if URL lookup should always use full path within current servlet
context. | public void | setDefaultEncoding(String defaultEncoding) 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. | public void | setUrlDecode(boolean urlDecode) Set if context path and request URI should be URL-decoded. |
getContextPath | public String getContextPath(HttpServletRequest request)(Code) | | 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.
Parameters: request - current HTTP request the context path |
getDefaultEncoding | protected String getDefaultEncoding()(Code) | | Return the default character encoding to use for URL decoding.
|
getOriginatingContextPath | public String getOriginatingContextPath(HttpServletRequest request)(Code) | | 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.
Parameters: request - current HTTP request the context path |
getOriginatingQueryString | public String getOriginatingQueryString(HttpServletRequest request)(Code) | | Return the request URI for root of the given request. If this is a forwarded request,
correctly resolves to the request URI of the original request. Relies on the Servlet
2.4 'forward' attributes. These attributes may be set by other components when
running in a Servlet 2.3 environment.
|
getOriginatingRequestUri | public String getOriginatingRequestUri(HttpServletRequest request)(Code) | | Return the request URI for root of the given request. If this is a forwarded request,
correctly resolves to the request URI of the original request. Relies on the Servlet
2.4 'forward' attributes. These attributes may be set by other components when
running in a Servlet 2.3 environment.
|
getPathWithinApplication | public String getPathWithinApplication(HttpServletRequest request)(Code) | | Return the path within the web application for the given request.
Detects include request URL if called within a RequestDispatcher include.
Parameters: request - current HTTP request the path within the web application |
getPathWithinServletMapping | public String getPathWithinServletMapping(HttpServletRequest request)(Code) | | 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" -> "".
Parameters: request - current HTTP request the path within the servlet mapping, or "" |
getRequestUri | public String getRequestUri(HttpServletRequest request)(Code) | | 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.
Parameters: request - current HTTP request the request URI |
getServletPath | public String getServletPath(HttpServletRequest request)(Code) | | 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.
Parameters: request - current HTTP request the servlet path |
setAlwaysUseFullPath | public void setAlwaysUseFullPath(boolean alwaysUseFullPath)(Code) | | 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".
|
|
|