Interface MutableServletRequest

  • All Superinterfaces:
    javax.servlet.ServletRequest

    public interface MutableServletRequest
    extends javax.servlet.ServletRequest
    A servlet request that can be modified. It is very useful, for instance, when you need to change the values of some request parameters, inside a filter.
    Version:
    $Id: c3efb91d489921d73626a79ab70e842cc03eabdf $
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String getReferer()  
      javax.servlet.ServletRequest getRequest()  
      Object getSessionAttribute​(String attrName)  
      String removeParameter​(String name)
      Removes the request parameter with the specified name.
      void sendRedirect​(javax.servlet.ServletResponse response, String url)
      Redirects this request to the specified URL.
      String setParameter​(String name, String value)
      Sets the value of a request parameter.
      String[] setParameterValues​(String name, String[] values)
      Sets the values of a request parameter.
      Object setSessionAttribute​(String attrName, Object attrValue)
      Sets the value of a session attribute.
      • Methods inherited from interface javax.servlet.ServletRequest

        getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
    • Method Detail

      • setParameter

        String setParameter​(String name,
                            String value)
        Sets the value of a request parameter.
        Parameters:
        name - the name of the request parameter
        value - the new value of the request parameter
        Returns:
        the old value of the specified request parameter, or null if this is the first time we set its value
      • setParameterValues

        String[] setParameterValues​(String name,
                                    String[] values)
        Sets the values of a request parameter.
        Parameters:
        name - the name of the request parameter
        values - the new array of values for the specified request parameter
        Returns:
        the old values of the specified request parameter, or null if this is the first time we set its values
      • removeParameter

        String removeParameter​(String name)
        Removes the request parameter with the specified name.
        Parameters:
        name - a string representing the name of the request parameter to be removed
        Returns:
        the old value of the specified request parameter, or null if it wasn't set
      • sendRedirect

        void sendRedirect​(javax.servlet.ServletResponse response,
                          String url)
                   throws IOException
        Redirects this request to the specified URL. We had to add this method since there's no generic way to redirect a ServletRequest.
        Parameters:
        response - the response object used to redirect
        url - the location where to redirect
        Throws:
        IOException - if the redirect fails
      • getReferer

        String getReferer()
        Returns:
        the URL of the requester
      • getSessionAttribute

        Object getSessionAttribute​(String attrName)
        Parameters:
        attrName - the name of the session attribute whose value should be retrieved
        Returns:
        the value of the specified session attribute
      • setSessionAttribute

        Object setSessionAttribute​(String attrName,
                                   Object attrValue)
        Sets the value of a session attribute.
        Parameters:
        attrName - the name of the session attribute
        attrValue - the value to be set
        Returns:
        the previous value of the specified session attribute
      • getRequest

        javax.servlet.ServletRequest getRequest()
        Returns:
        the request object wrapped by this object