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 ; }
Get the cached ScopedRequest wrapper . If none exists creates one and caches it .