java.lang.Object
com.aoapps.servlet.http.Dispatcher
Static utilities that may be useful by servlet/JSP/taglib environments.
- Author:
- AO Industries, Inc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ScopeEE.Request.Attribute<Map<String, ?>> The name of the request-scope Map that will contain the arguments for the current page. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidforward(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) static voidforward(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) Performs a forward with the provided servlet path and associated dispatcher.static voidforward(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response) static voidforward(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) Performs a forward, allowing page-relative paths and setting all values compatible with <ao:forward> tag.static StringgetCurrentPagePath(HttpServletRequest request) Gets the current page path, including any effects from include/forward.static StringgetDispatchedPage(ServletRequest request) Gets the current request dispatched page or null if not set.static StringgetOriginalPage(ServletRequest request) Gets the current request original page or null if not set.static StringgetOriginalPagePath(HttpServletRequest request) Gets the original page path corresponding to the original request before any forward/include.static voidinclude(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) static voidinclude(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) Performs a forward with the provided servlet path and associated dispatcher.static voidinclude(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response) static voidinclude(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) Performs an include, allowing page-relative paths and setting all values compatible with <ao:include> tag.static voidsetDispatchedPage(ServletRequest request, String dispatchedPage) Sets the current request dispatched page.static voidsetOriginalPage(ServletRequest request, String page) Sets the current request original page.
-
Field Details
-
ARG_REQUEST_ATTRIBUTE
The name of the request-scope Map that will contain the arguments for the current page.
-
-
Method Details
-
getOriginalPage
Gets the current request original page or null if not set.- See Also:
-
setOriginalPage
Sets the current request original page. -
getOriginalPagePath
Gets the original page path corresponding to the original request before any forward/include. If no original page available, uses the servlet path from the provided request.- See Also:
-
getDispatchedPage
Gets the current request dispatched page or null if not set.- See Also:
-
setDispatchedPage
Sets the current request dispatched page. -
getCurrentPagePath
Gets the current page path, including any effects from include/forward. This will be the path of the current page on forward or include. This may be used as a substitute for HttpServletRequest.getServletPath() when the current page is needed instead of the originally requested servlet.- See Also:
-
forward
public static void forward(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) throws ServletException, IOExceptionPerforms a forward with the provided servlet path and associated dispatcher.- Parameters:
args- The arguments for the page, make unmodifiable and accessible as request-scope var "arg"- Throws:
ServletExceptionIOException
-
forward
public static void forward(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - Throws:
ServletExceptionIOException- See Also:
-
forward
public static void forward(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) throws ServletException, IOExceptionPerforms a forward, allowing page-relative paths and setting all values compatible with <ao:forward> tag.- Parameters:
args- The arguments for the page, make unmodifiable and accessible as request-scope var "arg"- Throws:
ServletExceptionIOException- See Also:
-
forward
public static void forward(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - Throws:
ServletExceptionIOException- See Also:
-
include
public static void include(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) throws SkipPageException, ServletException, IOExceptionPerforms a forward with the provided servlet path and associated dispatcher.- Parameters:
args- The arguments for the page, make unmodifiable and accessible as request-scope var "arg"- Throws:
SkipPageException- when the included page has been skipped due to a redirect.ServletExceptionIOException
-
include
public static void include(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) throws SkipPageException, ServletException, IOException - Throws:
SkipPageExceptionServletExceptionIOException- See Also:
-
include
public static void include(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) throws SkipPageException, ServletException, IOExceptionPerforms an include, allowing page-relative paths and setting all values compatible with <ao:include> tag.- Parameters:
args- The arguments for the page, make unmodifiable and accessible as request-scope var "arg"- Throws:
SkipPageException- when the included page has been skipped due to a redirect.ServletExceptionIOException- See Also:
-
include
public static void include(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response) throws SkipPageException, ServletException, IOException - Throws:
SkipPageExceptionServletExceptionIOException- See Also:
-
