public class SecureRequestUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static org.apache.struts.util.MessageResources |
messages
The message resources.
|
Constructor and Description |
---|
SecureRequestUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkSsl(SecureActionConfig aMapping,
javax.servlet.ServletContext aContext,
javax.servlet.http.HttpServletRequest aRequest,
javax.servlet.http.HttpServletResponse aResponse)
Checks to see if SSL should be toggled for this
action
|
static java.lang.String |
computeURL(javax.servlet.jsp.PageContext pageContext,
java.lang.String forward,
java.lang.String href,
java.lang.String page,
java.lang.String action,
java.lang.String module,
java.util.Map params,
java.lang.String anchor,
boolean redirect)
Compute a hyperlink URL based on the
forward ,
href , or page parameter that is not null. |
static java.lang.StringBuffer |
createQueryStringFromMap(java.util.Map m,
java.lang.String ampersand)
Builds a query string from a given map of parameters
|
static java.lang.String |
getRedirectString(javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletContext application,
java.lang.String isSecure)
Creates a redirect URL string if the current request should be redirected
|
static java.lang.String |
getRequestParameters(javax.servlet.http.HttpServletRequest aRequest)
Creates query String from request body parameters
|
static void |
reclaimRequestAttributes(javax.servlet.http.HttpServletRequest aRequest,
boolean doRemove)
Reclaims request attributes from session to request
|
static org.apache.struts.config.ModuleConfig |
selectModule(java.lang.String urlPath,
javax.servlet.jsp.PageContext pageContext)
Select the module to which the specified request belongs.
|
static boolean |
stowRequestAttributes(javax.servlet.http.HttpServletRequest aRequest)
Stores request attributes in session
|
protected static org.apache.struts.util.MessageResources messages
public static java.lang.String computeURL(javax.servlet.jsp.PageContext pageContext, java.lang.String forward, java.lang.String href, java.lang.String page, java.lang.String action, java.lang.String module, java.util.Map params, java.lang.String anchor, boolean redirect) throws java.net.MalformedURLException
forward
,
href
, or page
parameter that is not null.
The returned URL will have already been passed to
response.encodeURL()
for adding a session identifier.pageContext
- PageContext for the tag making this callforward
- Logical forward name for which to look up
the context-relative URI (if specified)href
- URL to be utilized unmodified (if specified)page
- Context-relative page for which a URL should
be created (if specified)action
- a Struts action nameparams
- Map of parameters to be dynamically included (if any)anchor
- Anchor to be dynamically included (if any)redirect
- Is this URL for a response.sendRedirect()
?java.net.MalformedURLException
- if a URL cannot be created
for the specified parameterspublic static java.lang.String getRequestParameters(javax.servlet.http.HttpServletRequest aRequest)
aRequest
- The current requestpublic static java.lang.StringBuffer createQueryStringFromMap(java.util.Map m, java.lang.String ampersand)
m
- A map of parametersampersand
- String to use for ampersands (e.g. "&" or "&" )public static boolean stowRequestAttributes(javax.servlet.http.HttpServletRequest aRequest)
aRequest
- The current requestpublic static void reclaimRequestAttributes(javax.servlet.http.HttpServletRequest aRequest, boolean doRemove)
aRequest
- The current requestdoRemove
- True, if the attributes should be removed after being reclaimed,
false otherwisepublic static java.lang.String getRedirectString(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext application, java.lang.String isSecure)
request
- current servlet requestapplication
- the currecnt ServletContextisSecure
- "true" if the current request should be transmitted via SSL
"false" if not, "any" if we just don't care if it's SSL or notpublic static org.apache.struts.config.ModuleConfig selectModule(java.lang.String urlPath, javax.servlet.jsp.PageContext pageContext)
urlPath
- The requested URLpageContext
- The ServletContext for this web applicationpublic static boolean checkSsl(SecureActionConfig aMapping, javax.servlet.ServletContext aContext, javax.servlet.http.HttpServletRequest aRequest, javax.servlet.http.HttpServletResponse aResponse)
aMapping
- The mapping object for this ActionaContext
- The current ServletContextaRequest
- The current request objectaResponse
- The current response objectCopyright 1999, 2017 The Apache Software Foundation, All Rights Reserved