code: public static void renameScope( Object oldScopeKey, Object newScopeKey, HttpServletRequest request )
      {
          assert ! ( request instanceof ScopedRequest );
          
          String requestAttr = getScopedName( OVERRIDE_REQUEST_ATTR, oldScopeKey );
          String responseAttr = getScopedName( OVERRIDE_RESPONSE_ATTR, oldScopeKey );
          ScopedRequest scopedRequest = ( ScopedRequest ) request.getAttribute( requestAttr );
          ScopedResponse scopedResponse = ( ScopedResponse ) request.getAttribute( responseAttr );
          
          if ( scopedRequest != null )
          {
              scopedRequest.renameScope( newScopeKey );
              request.removeAttribute( requestAttr );
              requestAttr = getScopedName( OVERRIDE_REQUEST_ATTR, newScopeKey );
              request.setAttribute( requestAttr, scopedRequest );
          }
          else
          {
              ScopedRequestImpl.renameSessionScope( oldScopeKey, newScopeKey, request );
          }
  
          if ( scopedResponse != null )
          {
              request.removeAttribute( responseAttr );
              responseAttr = getScopedName( OVERRIDE_RESPONSE_ATTR, newScopeKey );
              request.setAttribute( responseAttr, scopedResponse );
          }
      }
docs: Find all scoped objects ({@link ScopedRequest}, {@link ScopedResponse})
  which have a certain scope-key, replaces this scope-key with the new one, and re-caches the objects
  the new scope-key.
  @param oldScopeKey
  @param newScopeKey
  @param request the real (outer) request, where the scoped objects are cached.