public static ScopedRequest getScopedRequest( HttpServletRequest realRequest, String overrideURI,
                                                  ServletContext servletContext, Object scopeKey,
                                                  boolean seeOuterRequestAttributes )
    {
        assert ! ( realRequest instanceof ScopedRequest );
        
        String requestAttr = getScopedName( OVERRIDE_REQUEST_ATTR, scopeKey );
        ScopedRequest scopedRequest = ( ScopedRequest ) realRequest.getAttribute( requestAttr );
        
        //
        // If it doesn't exist, create it and cache it.
        //
        if ( scopedRequest == null )
        {
            //
            // The override URI must start with a slash -- it's webapp-relative.
            //
            if ( overrideURI != null && ! overrideURI.startsWith( "/" ) ) overrideURI = '/' + overrideURI;
            
            scopedRequest = 
                new ScopedRequestImpl( realRequest, overrideURI, scopeKey, servletContext, seeOuterRequestAttributes );
            realRequest.setAttribute( requestAttr, scopedRequest );            
        }
        
        return scopedRequest;
    }
public static ScopedRequest getScopedRequest ( HttpServletRequest realRequest , String overrideURI , ServletContext servletContext , Object scopeKey , boolean seeOuterRequestAttributes ) { assert ! ( realRequest instanceof ScopedRequest ) ; String requestAttr = getScopedName ( OVERRIDE_REQUEST_ATTR , scopeKey ) ; ScopedRequest scopedRequest = ( ScopedRequest ) realRequest . getAttribute ( requestAttr ) ; if ( scopedRequest == null ) { if ( overrideURI != null && ! overrideURI . startsWith ( "/" ) ) overrideURI = '/' + overrideURI ; scopedRequest = new ScopedRequestImpl ( realRequest , overrideURI , scopeKey , servletContext , seeOuterRequestAttributes ) ; realRequest . setAttribute ( requestAttr , scopedRequest ) ; } return scopedRequest ; }
Get the cached ScopedRequest wrapper.  If none exists, creates one and caches it.

@param realRequest the "real" (outer) HttpServletRequest, which will be wrapped.
@param overrideURI the request-URI for the wrapped object.  This URI must begin with the context path.
@param servletContext the current ServletContext.
@param scopeKey the scope-key associated with the new (or looked-up) scoped request.
@param seeOuterRequestAttributes if <code>true</code>, a request attribute will be "seen" in the outer request,
if it is not found within the scoped request; if <code>false</code>, attributes are only seen when
they are present in the scoped request.
@return the cached (or newly-created) ScopedRequest.