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
Modifier 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 void
forward
(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) static void
forward
(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) Performs a forward with the provided servlet path and associated dispatcher.static void
forward
(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response) static void
forward
(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 String
getCurrentPagePath
(HttpServletRequest request) Gets the current page path, including any effects from include/forward.static String
getDispatchedPage
(ServletRequest request) Gets the current request dispatched page or null if not set.static String
getOriginalPage
(ServletRequest request) Gets the current request original page or null if not set.static String
getOriginalPagePath
(HttpServletRequest request) Gets the original page path corresponding to the original request before any forward/include.static void
include
(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) static void
include
(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response, Map<String, ?> args) Performs a forward with the provided servlet path and associated dispatcher.static void
include
(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response) static void
include
(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 void
setDispatchedPage
(ServletRequest request, String dispatchedPage) Sets the current request dispatched page.static void
setOriginalPage
(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:
ServletException
IOException
-
forward
public static void forward(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - Throws:
ServletException
IOException
- 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:
ServletException
IOException
- See Also:
-
forward
public static void forward(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - Throws:
ServletException
IOException
- 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.ServletException
IOException
-
include
public static void include(String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) throws SkipPageException, ServletException, IOException - Throws:
SkipPageException
ServletException
IOException
- 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.ServletException
IOException
- See Also:
-
include
public static void include(ServletContext servletContext, String page, HttpServletRequest request, HttpServletResponse response) throws SkipPageException, ServletException, IOException - Throws:
SkipPageException
ServletException
IOException
- See Also:
-