| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Helper class for URL path matching. Provides support for URL paths in ServletDispatcher includes, and support for URL decoding.
Used by AbstractUrlHandlerMapping and AbstractMethodNameResolver.
| Field Summary | |
final static String | DEFAULT_CHARACTER_ENCODINGDefault character encoding to use when request.getCharacterEncoding returns null, according to the Servlet spec. |
final static String | INCLUDE_CONTEXT_PATH_REQUEST_ATTRIBUTE |
final static String | INCLUDE_SERVLET_PATH_REQUEST_ATTRIBUTE |
final static String | INCLUDE_URI_REQUEST_ATTRIBUTEStandard servlet spec request attributes for include URI and paths. |
| Method Summary | |
String | decodeRequestString(ServletRequest request, String source)Decode the given source string with a URLEncoder. |
String | getContextPath(HttpServletRequest request)Return the context path for the given request, regarding an include request URL if called within a RequestDispatcher include. |
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. |
String | getPathWithinApplication(HttpServletRequest request)Return the path within the web application for the given request. |
String | getPathWithinServletMapping(HttpServletRequest request)Return the path within the servlet mapping for the given request, i.e. |
String | getRequestUri(HttpServletRequest request)Return the request URI for the given request, regarding an include request URL if called within a RequestDispatcher include. |
String | getServletPath(HttpServletRequest request)Return the servlet path for the given request, regarding an include request URL if called within a RequestDispatcher include. |
void | setAlwaysUseFullPath(boolean alwaysUseFullPath)Set if URL lookup should always use full path within current servlet context. |
void | setUrlDecode(boolean urlDecode)Set if context path and request URI should be URL-decoded. |
| Field Detail |
public final static String DEFAULT_CHARACTER_ENCODING
public final static String INCLUDE_CONTEXT_PATH_REQUEST_ATTRIBUTE
public final static String INCLUDE_SERVLET_PATH_REQUEST_ATTRIBUTE
public final static String INCLUDE_URI_REQUEST_ATTRIBUTE
If included via a RequestDispatcher, the current resource will see the original request. Its own URI and paths are exposed as request attributes.
| Method Detail |
public String decodeRequestString(ServletRequest request, String source)
public String getContextPath(HttpServletRequest request)
As the value returned by request.getContextPath() is not decoded by the servlet container, this method will decode it.
public String getLookupPathForRequest(HttpServletRequest request)
Regards include request URL if called within a RequestDispatcher include.
public String getPathWithinApplication(HttpServletRequest request)
Regards include request URL if called within a RequestDispatcher include.
public String getPathWithinServletMapping(HttpServletRequest request)
Regards 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" -> "".
public String getRequestUri(HttpServletRequest request)
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.
public String getServletPath(HttpServletRequest request)
As the value returned by request.getServletPath() is already decoded by the servlet container, this method will not attempt to decode it.
public void setAlwaysUseFullPath(boolean alwaysUseFullPath)
public void setUrlDecode(boolean urlDecode)
Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).
Note: Setting this to true requires J2SE 1.4, as J2SE 1.3's URLDecoder class does not offer a way to specify the encoding.
| Association Links |
to Class java.lang.String
If included via a RequestDispatcher, the current resource will see the original request. Its own URI and paths are exposed as request attributes.
to Class java.lang.String
to Class java.lang.String
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||