org.apache.struts2.dispatcher

## Class StrutsRequestWrapper

- java.lang.Object
- - javax.servlet.ServletRequestWrapper
  - - javax.servlet.http.HttpServletRequestWrapper
    - - org.apache.struts2.dispatcher.StrutsRequestWrapper

- All Implemented Interfaces:
    javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest
  Direct Known Subclasses:
    MultiPartRequestWrapper

      public class StrutsRequestWrapper
      extends javax.servlet.http.HttpServletRequestWrapper

  All Struts requests are wrapped with this class, which provides simple JSTL accessibility. This is because JSTL works with request attributes, so this class delegates to the value stack except for a few cases where required to prevent infinite loops. Namely, we don't let any attribute name with "#" in it delegate out to the value stack, as it could potentially cause an infinite loop. For example, an infinite loop would take place if you called: request.getAttribute("#attr.foo").

- - ### Field Summary

    - ### Fields inherited from interface javax.servlet.http.HttpServletRequest

      `BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrutsRequestWrapper(javax.servlet.http.HttpServletRequest req)` The constructor
    `StrutsRequestWrapper(javax.servlet.http.HttpServletRequest req, boolean disableRequestAttributeValueStackLookup)` The constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getAttribute(String key)` Gets the object, looking in the value stack if not found

    - ### Methods inherited from class javax.servlet.http.HttpServletRequestWrapper

      `getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole`

    - ### Methods inherited from class javax.servlet.ServletRequestWrapper

      `getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest`

    - ### 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

      `getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding`

- - ### Constructor Detail

    - #### StrutsRequestWrapper

          public StrutsRequestWrapper(javax.servlet.http.HttpServletRequest req)

      The constructor
      Parameters:
        `req` - The request

    - #### StrutsRequestWrapper

          public StrutsRequestWrapper(javax.servlet.http.HttpServletRequest req,
                              boolean disableRequestAttributeValueStackLookup)

      The constructor
      Parameters:
        `req` - The request
        `disableRequestAttributeValueStackLookup` - flag for disabling request attribute value stack lookup (JSTL accessibility)

  - ### Method Detail

    - #### getAttribute

          public Object getAttribute(String key)

      Gets the object, looking in the value stack if not found
      Specified by:
        `getAttribute` in interface `javax.servlet.ServletRequest`
      Overrides:
        `getAttribute` in class `javax.servlet.ServletRequestWrapper`
      Parameters:
        `key` - The attribute key

Copyright © 2000–2021 Apache Software Foundation. All rights reserved.