public class DispatcherUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FORWARD_CONTEXT_PATH |
static java.lang.String |
FORWARD_PATH_INFO |
static java.lang.String |
FORWARD_QUERY_STRING |
static java.lang.String |
FORWARD_REQUEST_URI |
static java.lang.String |
FORWARD_SERVLET_PATH |
static java.lang.String |
INCLUDE_CONTEXT_PATH |
static java.lang.String |
INCLUDE_PATH_INFO |
static java.lang.String |
INCLUDE_QUERY_STRING |
static java.lang.String |
INCLUDE_REQUEST_URI |
static java.lang.String |
INCLUDE_SERVLET_PATH |
Constructor and Description |
---|
DispatcherUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
forward(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String page)
Forward to page which path is relative to the current HTTP request.
|
static boolean |
forwardAbsolute(javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String page)
Forward to page path relative to the root of the ServletContext.
|
static boolean |
forwardAbsolute(javax.servlet.ServletContext context,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String resource)
Forward to page path relative to the root of the ServletContext.
|
static boolean |
forwardNamed(javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String resource)
Forward to named resource.
|
static boolean |
forwardNamed(javax.servlet.ServletContext context,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String resource)
Forward to named resource.
|
static java.lang.String |
getBaseContextPath(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getBasePathInfo(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getBaseQueryString(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getBaseRequestUri(javax.servlet.http.HttpServletRequest request)
Returns the base (top-level) uri.
|
static java.lang.String |
getBaseServletPath(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getContextPath(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getForwardContextPath(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getForwardPathInfo(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getForwardQueryString(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getForwardRequestUri(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getForwardServletPath(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getFullUrl(javax.servlet.http.HttpServletRequest request)
Returns full URL: uri + query string, including the context path.
|
static java.lang.String |
getIncludeContextPath(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getIncludePathInfo(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getIncludeQueryString(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getIncludeRequestUri(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getIncludeServletPath(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getPathInfo(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getQueryString(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getRequestUri(javax.servlet.http.HttpServletRequest request)
Get current request uri.
|
static java.lang.String |
getServletPath(javax.servlet.http.HttpServletRequest request) |
static java.lang.String |
getUrl(javax.servlet.http.HttpServletRequest request)
Returns url, without context path, convenient for request dispatcher.
|
static boolean |
include(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String page)
Include page which path is relative to the current HTTP request.
|
static boolean |
includeAbsolute(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String page)
Include page which path relative to the root of the ServletContext.
|
static boolean |
includeAbsolute(javax.servlet.ServletContext context,
javax.servlet.ServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String page)
Include page which path relative to the root of the ServletContext.
|
static boolean |
includeNamed(javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String resource)
Include named resource.
|
static boolean |
includeNamed(javax.servlet.ServletContext context,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String page)
Include named resource.
|
static boolean |
isPageIncluded(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Returns
true if current page is included. |
static boolean |
isTopLevelRequest(javax.servlet.http.HttpServletRequest request)
Returns
true if request is a top-level one, i.e. previously
not included or forwarded. |
static void |
redirect(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String url)
Performs redirection (302) to specified url.
|
static void |
redirectPermanent(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String url)
Performs permanent redirection (301) to specified url.
|
public static final java.lang.String INCLUDE_REQUEST_URI
public static final java.lang.String INCLUDE_CONTEXT_PATH
public static final java.lang.String INCLUDE_SERVLET_PATH
public static final java.lang.String INCLUDE_PATH_INFO
public static final java.lang.String INCLUDE_QUERY_STRING
public static final java.lang.String FORWARD_REQUEST_URI
public static final java.lang.String FORWARD_CONTEXT_PATH
public static final java.lang.String FORWARD_SERVLET_PATH
public static final java.lang.String FORWARD_PATH_INFO
public static final java.lang.String FORWARD_QUERY_STRING
public static boolean include(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String page) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean includeNamed(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletResponse response, java.lang.String resource) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean includeNamed(javax.servlet.ServletContext context, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String page) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean includeAbsolute(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String page) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean includeAbsolute(javax.servlet.ServletContext context, javax.servlet.ServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String page) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean forward(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String page) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean forwardNamed(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletResponse response, java.lang.String resource) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean forwardNamed(javax.servlet.ServletContext context, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String resource) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean forwardAbsolute(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletResponse response, java.lang.String page) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static boolean forwardAbsolute(javax.servlet.ServletContext context, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String resource) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public static void redirect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String url) throws java.io.IOException
java.io.IOException
public static void redirectPermanent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String url)
public static java.lang.String getFullUrl(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getUrl(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getIncludeRequestUri(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getIncludeContextPath(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getIncludeServletPath(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getIncludePathInfo(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getIncludeQueryString(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getForwardRequestUri(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getForwardContextPath(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getForwardServletPath(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getForwardPathInfo(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getForwardQueryString(javax.servlet.http.HttpServletRequest request)
public static boolean isPageIncluded(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
true
if current page is included.public static boolean isTopLevelRequest(javax.servlet.http.HttpServletRequest request)
true
if request is a top-level one, i.e. previously
not included or forwarded.public static java.lang.String getBaseRequestUri(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getRequestUri(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getBaseContextPath(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getContextPath(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getBaseServletPath(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getServletPath(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getBasePathInfo(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getPathInfo(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getBaseQueryString(javax.servlet.http.HttpServletRequest request)
public static java.lang.String getQueryString(javax.servlet.http.HttpServletRequest request)
Copyright © 2003-present Jodd Team