Class GrouperRequestWrapper

java.lang.Object
javax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
edu.internet2.middleware.grouper.j2ee.GrouperRequestWrapper
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class GrouperRequestWrapper extends javax.servlet.http.HttpServletRequestWrapper
wrap request so we can customize
  • Field Summary

    Fields inherited from interface javax.servlet.http.HttpServletRequest

    BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
  • Constructor Summary

    Constructors
    Constructor
    Description
    GrouperRequestWrapper(javax.servlet.http.HttpServletRequest request)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    param boolean for EL
    Use this instead of request.getParameter as it will handle file uploads.
    Get a boolean from the input.
    boolean
    getParameterBoolean(String name, boolean theDefault)
    Get a boolean from the input.
    org.apache.commons.fileupload.FileItem
    get a param from file request as fileItem
    Get the parameter names from the fast request
    Return an array of strings for an input parameter
     
    problem with tomcat and request wrappers, so stash this and get back later: http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/
    javax.servlet.http.HttpSession
     
    javax.servlet.http.HttpSession
    getSession(boolean create)
     
    void
    init
    boolean
    if is multipart request
    find the request parameter names by prefix
    retrieveGrouperRequestWrapper(javax.servlet.ServletRequest servletRequest)
    get the grouper request wrapper

    Methods inherited from class javax.servlet.http.HttpServletRequestWrapper

    authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getServletPath, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole, login, logout, upgrade

    Methods inherited from class javax.servlet.ServletRequestWrapper

    getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getProtocol, getReader, getRealPath, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface javax.servlet.ServletRequest

    getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getProtocol, getReader, getRealPath, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
  • Constructor Details

    • GrouperRequestWrapper

      public GrouperRequestWrapper(javax.servlet.http.HttpServletRequest request)
      Parameters:
      request -
  • Method Details

    • retrieveGrouperRequestWrapper

      public static GrouperRequestWrapper retrieveGrouperRequestWrapper(javax.servlet.ServletRequest servletRequest)
      get the grouper request wrapper
      Returns:
    • getRemoteAddr

      public String getRemoteAddr()
      Specified by:
      getRemoteAddr in interface javax.servlet.ServletRequest
      Overrides:
      getRemoteAddr in class javax.servlet.ServletRequestWrapper
    • isMultipart

      public boolean isMultipart()
      if is multipart request
      Returns:
    • getAttribute

      public Object getAttribute(String name)
      Specified by:
      getAttribute in interface javax.servlet.ServletRequest
      Overrides:
      getAttribute in class javax.servlet.ServletRequestWrapper
      See Also:
      • ServletRequestWrapper.getAttribute(java.lang.String)
    • getParameterFileItem

      public org.apache.commons.fileupload.FileItem getParameterFileItem(String name)
      get a param from file request as fileItem
      Parameters:
      name -
      Returns:
      the param
    • init

      public void init()
      init
    • getSession

      public javax.servlet.http.HttpSession getSession()
      Specified by:
      getSession in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getSession in class javax.servlet.http.HttpServletRequestWrapper
      See Also:
      • HttpServletRequestWrapper.getSession()
    • getSession

      public javax.servlet.http.HttpSession getSession(boolean create)
      Specified by:
      getSession in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getSession in class javax.servlet.http.HttpServletRequestWrapper
      See Also:
      • HttpServletRequestWrapper.getSession(boolean)
    • getRequestURL

      public StringBuffer getRequestURL()
       problem with tomcat and request wrappers, so stash this and
       get back later:
       http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/
       
      Specified by:
      getRequestURL in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getRequestURL in class javax.servlet.http.HttpServletRequestWrapper
      See Also:
      • HttpServletRequestWrapper.getRequestURL()
    • requestParameterNamesByPrefix

      public Set<String> requestParameterNamesByPrefix(String prefix)
      find the request parameter names by prefix
      Parameters:
      prefix -
      Returns:
      the set, never null
    • getParameterNames

      public Enumeration getParameterNames()
      Get the parameter names from the fast request
      Specified by:
      getParameterNames in interface javax.servlet.ServletRequest
      Overrides:
      getParameterNames in class javax.servlet.ServletRequestWrapper
      Returns:
      get parameter names passed in
    • getParameterValues

      public String[] getParameterValues(String name)
      Return an array of strings for an input parameter
      Specified by:
      getParameterValues in interface javax.servlet.ServletRequest
      Overrides:
      getParameterValues in class javax.servlet.ServletRequestWrapper
      Parameters:
      name -
      Returns:
      parameter values based on name
    • getParameter

      public Map getParameter()
      param boolean for EL
      Returns:
      the boolean value of param
    • getHeader

      public String getHeader(String name)
      Specified by:
      getHeader in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getHeader in class javax.servlet.http.HttpServletRequestWrapper
    • getParameter

      public String getParameter(String name)
      Use this instead of request.getParameter as it will handle file uploads. If the parameter is in fast a file, this method will return the filepath. However, please do not call this method for files, please use getParameterFile(name).
      Specified by:
      getParameter in interface javax.servlet.ServletRequest
      Overrides:
      getParameter in class javax.servlet.ServletRequestWrapper
      Parameters:
      name -
      Returns:
      get a certain param
    • getParameterBoolean

      public Boolean getParameterBoolean(String name)
      Get a boolean from the input. must be true or false or not existent. For expression language, just use getParameter as string
      Parameters:
      name -
      Returns:
      TRUE or FALSE or null
    • getParameterBoolean

      public boolean getParameterBoolean(String name, boolean theDefault)
      Get a boolean from the input. mus tbe true or false or not existent.
      Parameters:
      name -
      theDefault - is what to return if param not there (usually false)
      Returns:
      TRUE or FALSE or null