Class SecureRequestUtils
java.lang.Object
com.echothree.view.client.web.struts.sslext.util.SecureRequestUtils
Define some additional utility methods utilized by sslext.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.apache.struts.util.MessageResources
The message resources. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkSsl
(SecureActionMapping 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 actionstatic String
computeURL
(javax.servlet.jsp.PageContext pageContext, String forward, String href, String page, String action, Map params, String anchor, boolean redirect) Compute a hyperlink URL based on theforward
,href
, orpage
parameter that is not null.static StringBuilder
createQueryStringFromMap
(Map m, String ampersand) Builds a query string from a given map of parametersstatic String
getRedirectString
(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext application, String isSecure) Creates a redirect URL string if the current request should be redirectedstatic String
getRequestParameters
(javax.servlet.http.HttpServletRequest aRequest) Creates query String from request body parametersstatic void
reclaimRequestAttributes
(javax.servlet.http.HttpServletRequest aRequest, boolean doRemove) Reclaims request attributes from session to requeststatic org.apache.struts.config.ModuleConfig
selectModule
(String urlPath, javax.servlet.jsp.PageContext pageContext) Select the sub-application to which the specified request belongs, and add corresponding request attributes to this request.static boolean
stowRequestAttributes
(javax.servlet.http.HttpServletRequest aRequest) Stores request attributes in session
-
Field Details
-
messages
The message resources.
-
-
Constructor Details
-
SecureRequestUtils
public SecureRequestUtils()
-
-
Method Details
-
computeURL
public static String computeURL(javax.servlet.jsp.PageContext pageContext, String forward, String href, String page, String action, Map params, String anchor, boolean redirect) throws MalformedURLException Compute a hyperlink URL based on theforward
,href
, orpage
parameter that is not null. The returned URL will have already been passed toresponse.encodeURL()
for adding a session identifier.- Parameters:
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 aresponse.sendRedirect()
?- Throws:
MalformedURLException
- if a URL cannot be created for the specified parameters
-
getRequestParameters
Creates query String from request body parameters- Parameters:
aRequest
- The current request- Returns:
- The created query string (with no leading "?")
-
createQueryStringFromMap
Builds a query string from a given map of parameters- Parameters:
m
- A map of parametersampersand
- String to use for ampersands (e.g. "&" or "&" )- Returns:
- query string (with no leading "?")
-
stowRequestAttributes
Stores request attributes in session- Parameters:
aRequest
- The current request- Returns:
- true, if the attributes were stowed in the session, false otherwise
-
reclaimRequestAttributes
public static void reclaimRequestAttributes(javax.servlet.http.HttpServletRequest aRequest, boolean doRemove) Reclaims request attributes from session to request- Parameters:
aRequest
- The current requestdoRemove
- True, if the attributes should be removed after being reclaimed, false otherwise
-
getRedirectString
public static String getRedirectString(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext application, String isSecure) Creates a redirect URL string if the current request should be redirected- Parameters:
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 not- Returns:
- the URL to redirect to
-
selectModule
public static org.apache.struts.config.ModuleConfig selectModule(String urlPath, javax.servlet.jsp.PageContext pageContext) Select the sub-application to which the specified request belongs, and add corresponding request attributes to this request.- Parameters:
urlPath
- The requested URLpageContext
- The ServletContext for this web application- Returns:
- The ModuleConfig for the given URL path
-
checkSsl
public static boolean checkSsl(SecureActionMapping 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- Parameters:
aMapping
- The mapping object for this ActionaContext
- The current ServletContextaRequest
- The current request objectaResponse
- The current response object- Returns:
- true, if being redirected, false otherwise
-