public static ScopedResponse getScopedResponse ( HttpServletResponse realResponse , ScopedRequest scopedRequest ) { assert ! ( realResponse instanceof ScopedResponse ) ; String responseAttr = getScopedName ( OVERRIDE_RESPONSE_ATTR , scopedRequest . getScopeKey ( ) ) ; HttpServletRequest outerRequest = scopedRequest . getOuterRequest ( ) ; ScopedResponse scopedResponse = ( ScopedResponse ) outerRequest . getAttribute ( responseAttr ) ; // // If it doesn't exist, create it and cache it. // if ( scopedResponse == null ) { scopedResponse = new ScopedResponseImpl ( realResponse ) ; outerRequest . setAttribute ( responseAttr , scopedResponse ) ; } return scopedResponse ; }
Get the cached wrapper servlet response . If none exists creates one and caches it .