Class RequestStateHelper
java.lang.Object
org.deltava.util.redirect.RequestStateHelper
A utility class to save and restore servlet request state.
- Since:
- 1.0
- Version:
- 11.1
- Author:
- Luke
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The name of the HTTP session attribute used to save servlet request state. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear
(HttpServletRequest req) Helper method to remove the request state object from the session, if found.static String
Restores the current servlet request state.static void
save
(HttpServletRequest req, String url) Saves the current servlet request state to the current HTTP session.
-
Field Details
-
STATE_ATTR_NAME
The name of the HTTP session attribute used to save servlet request state.- See Also:
-
-
Method Details
-
restore
Restores the current servlet request state. This will load the request state from the current HTTP session and populate the request attributes. Existing request attributes will be overwritten.- Parameters:
req
- the current servlet request- Returns:
- the URL to forward to
- Throws:
IllegalStateException
- if there is no current HTTP session, or the request state attribute is not present in the session
-
save
Saves the current servlet request state to the current HTTP session.- Parameters:
req
- the current servlet requesturl
- the URL to forward to after the servlet request state is restored- Throws:
IllegalStateException
- if an HTTP session does not currently exist
-
clear
Helper method to remove the request state object from the session, if found.- Parameters:
req
- the current servlet request
-