Class ApplicationHttpRequest

  • All Implemented Interfaces:
    jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest

    public class ApplicationHttpRequest
    extends jakarta.servlet.http.HttpServletRequestWrapper
    Wrapper around a jakarta.servlet.http.HttpServletRequest that transforms an application request object (which might be the original one passed to a servlet, or might be based on the 2.3 jakarta.servlet.http.HttpServletRequestWrapper class) back into an internal org.apache.catalina.HttpRequest.
    Version:
    $Revision: 1.15 $ $Date: 2007/05/03 21:58:54 $
    Author:
    Craig R. McClanahan, Remy Maucherat
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Context context
      The context for this request.
      protected String contextPath
      The context path for this request.
      protected boolean crossContext
      If this request is cross context, since this changes session access behavior.
      protected jakarta.servlet.DispatcherType dispatcherType
      The dispatcher type.
      protected Map<String,​String[]> parameters
      The request parameters for this request.
      protected String pathInfo
      The path information for this request.
      protected String queryString
      The query string for this request.
      protected Object requestDispatcherPath
      The current request dispatcher path.
      protected String requestURI
      The request URI for this request.
      protected String servletPath
      The servlet path for this request.
      protected Session session
      The currently active session for this request.
      • Fields inherited from interface jakarta.servlet.http.HttpServletRequest

        BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
    • Constructor Summary

      Constructors 
      Constructor Description
      ApplicationHttpRequest​(jakarta.servlet.http.HttpServletRequest request, Context context, boolean crossContext, jakarta.servlet.http.HttpServletMapping mappingForDispatch, jakarta.servlet.DispatcherType dispatcherType)
      Construct a new wrapped request around the specified servlet request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Object getAttribute​(String name)
      Override the getAttribute() method of the wrapped request.
      Enumeration<String> getAttributeNames()
      Override the getAttributeNames() method of the wrapped request.
      String getContextPath()
      Override the getContextPath() method of the wrapped request.
      jakarta.servlet.DispatcherType getDispatcherType()  
      jakarta.servlet.http.HttpServletMapping getHttpServletMapping()  
      String getParameter​(String name)
      Override the getParameter() method of the wrapped request.
      Map<String,​String[]> getParameterMap()
      Override the getParameterMap() method of the wrapped request.
      Enumeration<String> getParameterNames()
      Override the getParameterNames() method of the wrapped request.
      String[] getParameterValues​(String name)
      Override the getParameterValues() method of the wrapped request.
      String getPathInfo()
      Override the getPathInfo() method of the wrapped request.
      String getQueryString()
      Override the getQueryString() method of the wrapped request.
      jakarta.servlet.RequestDispatcher getRequestDispatcher​(String path)
      Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.
      RequestFacade getRequestFacade()
      Gets the facade for the request implementation object.
      String getRequestURI()
      Override the getRequestURI() method of the wrapped request.
      StringBuffer getRequestURL()
      Override the getRequestURL() method of the wrapped request.
      String getServletPath()
      Override the getServletPath() method of the wrapped request.
      jakarta.servlet.http.HttpSession getSession()
      Return the session associated with this Request, creating one if necessary.
      jakarta.servlet.http.HttpSession getSession​(boolean create)
      Return the session associated with this Request, creating one if necessary and requested.
      boolean isRequestedSessionIdValid()
      Returns true if the request specifies a JSESSIONID that is valid within the context of this ApplicationHttpRequest, false otherwise.
      protected boolean isSpecial​(String name)
      Is this attribute name one of the special ones that is added only for included servlets?
      protected String[] mergeValues​(Object values1, Object values2)
      Merge the two sets of parameter values into a single String array.
      jakarta.servlet.http.PushBuilder newPushBuilder()  
      void recycle()
      Recycle this request
      void removeAttribute​(String name)
      Override the removeAttribute() method of the wrapped request.
      void setAttribute​(String name, Object value)
      Override the setAttribute() method of the wrapped request.
      • Methods inherited from class jakarta.servlet.http.HttpServletRequestWrapper

        authenticate, changeSessionId, getAuthType, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathTranslated, getRemoteUser, getRequestedSessionId, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL, isTrailerFieldsReady, isUserInRole, login, logout, upgrade
      • Methods inherited from class jakarta.servlet.ServletRequestWrapper

        getAsyncContext, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, setCharacterEncoding, setRequest, startAsync, startAsync
      • Methods inherited from interface jakarta.servlet.ServletRequest

        getAsyncContext, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, setCharacterEncoding, startAsync, startAsync
    • Field Detail

      • context

        protected Context context
        The context for this request.
      • contextPath

        protected String contextPath
        The context path for this request.
      • crossContext

        protected boolean crossContext
        If this request is cross context, since this changes session access behavior.
      • dispatcherType

        protected jakarta.servlet.DispatcherType dispatcherType
        The dispatcher type.
      • parameters

        protected Map<String,​String[]> parameters
        The request parameters for this request. This is initialized from the wrapped request, but updates are allowed.
      • pathInfo

        protected String pathInfo
        The path information for this request.
      • queryString

        protected String queryString
        The query string for this request.
      • requestDispatcherPath

        protected Object requestDispatcherPath
        The current request dispatcher path.
      • requestURI

        protected String requestURI
        The request URI for this request.
      • servletPath

        protected String servletPath
        The servlet path for this request.
      • session

        protected Session session
        The currently active session for this request.
    • Constructor Detail

      • ApplicationHttpRequest

        public ApplicationHttpRequest​(jakarta.servlet.http.HttpServletRequest request,
                                      Context context,
                                      boolean crossContext,
                                      jakarta.servlet.http.HttpServletMapping mappingForDispatch,
                                      jakarta.servlet.DispatcherType dispatcherType)
        Construct a new wrapped request around the specified servlet request.
        Parameters:
        request - the servlet request being wrapped
        context - the target context of the request dispatch
        crossContext - true if this is a cross-context dispatch, false otherwise
        dispatcherType - the dispatcher type
    • Method Detail

      • getAttribute

        public Object getAttribute​(String name)
        Override the getAttribute() method of the wrapped request.
        Specified by:
        getAttribute in interface jakarta.servlet.ServletRequest
        Overrides:
        getAttribute in class jakarta.servlet.ServletRequestWrapper
        Parameters:
        name - Name of the attribute to retrieve
      • getAttributeNames

        public Enumeration<String> getAttributeNames()
        Override the getAttributeNames() method of the wrapped request.
        Specified by:
        getAttributeNames in interface jakarta.servlet.ServletRequest
        Overrides:
        getAttributeNames in class jakarta.servlet.ServletRequestWrapper
      • removeAttribute

        public void removeAttribute​(String name)
        Override the removeAttribute() method of the wrapped request.
        Specified by:
        removeAttribute in interface jakarta.servlet.ServletRequest
        Overrides:
        removeAttribute in class jakarta.servlet.ServletRequestWrapper
        Parameters:
        name - Name of the attribute to remove
      • setAttribute

        public void setAttribute​(String name,
                                 Object value)
        Override the setAttribute() method of the wrapped request.
        Specified by:
        setAttribute in interface jakarta.servlet.ServletRequest
        Overrides:
        setAttribute in class jakarta.servlet.ServletRequestWrapper
        Parameters:
        name - Name of the attribute to set
        value - Value of the attribute to set
      • getRequestDispatcher

        public jakarta.servlet.RequestDispatcher getRequestDispatcher​(String path)
        Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.
        Specified by:
        getRequestDispatcher in interface jakarta.servlet.ServletRequest
        Overrides:
        getRequestDispatcher in class jakarta.servlet.ServletRequestWrapper
        Parameters:
        path - Path of the resource to be wrapped
      • getDispatcherType

        public jakarta.servlet.DispatcherType getDispatcherType()
        Specified by:
        getDispatcherType in interface jakarta.servlet.ServletRequest
        Overrides:
        getDispatcherType in class jakarta.servlet.ServletRequestWrapper
      • getContextPath

        public String getContextPath()
        Override the getContextPath() method of the wrapped request.
        Specified by:
        getContextPath in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getContextPath in class jakarta.servlet.http.HttpServletRequestWrapper
      • getParameter

        public String getParameter​(String name)
        Override the getParameter() method of the wrapped request.
        Specified by:
        getParameter in interface jakarta.servlet.ServletRequest
        Overrides:
        getParameter in class jakarta.servlet.ServletRequestWrapper
        Parameters:
        name - Name of the requested parameter
      • getParameterMap

        public Map<String,​String[]> getParameterMap()
        Override the getParameterMap() method of the wrapped request.
        Specified by:
        getParameterMap in interface jakarta.servlet.ServletRequest
        Overrides:
        getParameterMap in class jakarta.servlet.ServletRequestWrapper
      • getParameterNames

        public Enumeration<String> getParameterNames()
        Override the getParameterNames() method of the wrapped request.
        Specified by:
        getParameterNames in interface jakarta.servlet.ServletRequest
        Overrides:
        getParameterNames in class jakarta.servlet.ServletRequestWrapper
      • getParameterValues

        public String[] getParameterValues​(String name)
        Override the getParameterValues() method of the wrapped request.
        Specified by:
        getParameterValues in interface jakarta.servlet.ServletRequest
        Overrides:
        getParameterValues in class jakarta.servlet.ServletRequestWrapper
        Parameters:
        name - Name of the requested parameter
      • getPathInfo

        public String getPathInfo()
        Override the getPathInfo() method of the wrapped request.
        Specified by:
        getPathInfo in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getPathInfo in class jakarta.servlet.http.HttpServletRequestWrapper
      • getQueryString

        public String getQueryString()
        Override the getQueryString() method of the wrapped request.
        Specified by:
        getQueryString in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getQueryString in class jakarta.servlet.http.HttpServletRequestWrapper
      • getRequestURI

        public String getRequestURI()
        Override the getRequestURI() method of the wrapped request.
        Specified by:
        getRequestURI in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getRequestURI in class jakarta.servlet.http.HttpServletRequestWrapper
      • getRequestURL

        public StringBuffer getRequestURL()
        Override the getRequestURL() method of the wrapped request.
        Specified by:
        getRequestURL in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getRequestURL in class jakarta.servlet.http.HttpServletRequestWrapper
      • getHttpServletMapping

        public jakarta.servlet.http.HttpServletMapping getHttpServletMapping()
        Specified by:
        getHttpServletMapping in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getHttpServletMapping in class jakarta.servlet.http.HttpServletRequestWrapper
      • getServletPath

        public String getServletPath()
        Override the getServletPath() method of the wrapped request.
        Specified by:
        getServletPath in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getServletPath in class jakarta.servlet.http.HttpServletRequestWrapper
      • getSession

        public jakarta.servlet.http.HttpSession getSession()
        Return the session associated with this Request, creating one if necessary.
        Specified by:
        getSession in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getSession in class jakarta.servlet.http.HttpServletRequestWrapper
      • getSession

        public jakarta.servlet.http.HttpSession getSession​(boolean create)
        Return the session associated with this Request, creating one if necessary and requested.
        Specified by:
        getSession in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        getSession in class jakarta.servlet.http.HttpServletRequestWrapper
        Parameters:
        create - Create a new session if one does not exist
      • isRequestedSessionIdValid

        public boolean isRequestedSessionIdValid()
        Returns true if the request specifies a JSESSIONID that is valid within the context of this ApplicationHttpRequest, false otherwise.
        Specified by:
        isRequestedSessionIdValid in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        isRequestedSessionIdValid in class jakarta.servlet.http.HttpServletRequestWrapper
        Returns:
        true if the request specifies a JSESSIONID that is valid within the context of this ApplicationHttpRequest, false otherwise.
      • newPushBuilder

        public jakarta.servlet.http.PushBuilder newPushBuilder()
        Specified by:
        newPushBuilder in interface jakarta.servlet.http.HttpServletRequest
        Overrides:
        newPushBuilder in class jakarta.servlet.http.HttpServletRequestWrapper
      • recycle

        public void recycle()
        Recycle this request
      • isSpecial

        protected boolean isSpecial​(String name)
        Is this attribute name one of the special ones that is added only for included servlets?
        Parameters:
        name - Attribute name to be tested
      • mergeValues

        protected String[] mergeValues​(Object values1,
                                       Object values2)
        Merge the two sets of parameter values into a single String array.
        Parameters:
        values1 - First set of values
        values2 - Second set of values
      • getRequestFacade

        public RequestFacade getRequestFacade()
        Gets the facade for the request implementation object.