Class SecureRequestUtils

java.lang.Object
com.echothree.view.client.web.struts.sslext.util.SecureRequestUtils

public class SecureRequestUtils extends Object
Define some additional utility methods utilized by sslext.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static org.apache.struts.util.MessageResources
    The message resources.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    static 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 the forward, href, or page parameter that is not null.
    Builds a query string from a given map of parameters
    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
    static 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(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • messages

      protected static org.apache.struts.util.MessageResources messages
      The message resources.
  • Constructor Details

  • 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 the 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.
      Parameters:
      pageContext - PageContext for the tag making this call
      forward - 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 name
      params - 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()?
      Throws:
      MalformedURLException - if a URL cannot be created for the specified parameters
    • getRequestParameters

      public static String getRequestParameters(javax.servlet.http.HttpServletRequest aRequest)
      Creates query String from request body parameters
      Parameters:
      aRequest - The current request
      Returns:
      The created query string (with no leading "?")
    • createQueryStringFromMap

      public static StringBuilder createQueryStringFromMap(Map m, String ampersand)
      Builds a query string from a given map of parameters
      Parameters:
      m - A map of parameters
      ampersand - String to use for ampersands (e.g. "&" or "&" )
      Returns:
      query string (with no leading "?")
    • stowRequestAttributes

      public static boolean stowRequestAttributes(javax.servlet.http.HttpServletRequest aRequest)
      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 request
      doRemove - 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 request
      application - the currecnt ServletContext
      isSecure - "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 URL
      pageContext - 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 Action
      aContext - The current ServletContext
      aRequest - The current request object
      aResponse - The current response object
      Returns:
      true, if being redirected, false otherwise