@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public static String forwardRequestForUrlMappingInfo ( HttpServletRequest request , HttpServletResponse response , UrlMappingInfo info , Map < String , Object > model , boolean includeParams ) throws ServletException , IOException { String forwardUrl = buildDispatchUrlForMapping ( info , includeParams ) ; for ( Map . Entry < String , Object > entry : model . entrySet ( ) ) { request . setAttribute ( entry . getKey ( ) , entry . getValue ( ) ) ; } //populateParamsForMapping(info); RequestDispatcher dispatcher = request . getRequestDispatcher ( forwardUrl ) ; // Clear the request attributes that affect view rendering. Otherwise // whatever we forward to may render the wrong thing! Note that we // don't care about the return value because we're delegating // responsibility for rendering the response. final GrailsWebRequest webRequest = GrailsWebRequest . lookup ( request ) ; webRequest . removeAttribute ( GrailsApplicationAttributes . MODEL_AND_VIEW , 0 ) ; info . configure ( webRequest ) ; webRequest . removeAttribute ( GrailsApplicationAttributes . GRAILS_CONTROLLER_CLASS_AVAILABLE , WebRequest . SCOPE_REQUEST ) ; webRequest . removeAttribute ( UrlMappingsHandlerMapping . MATCHED_REQUEST , WebRequest . SCOPE_REQUEST ) ; webRequest . removeAttribute ( "grailsWebRequestFilter" + OncePerRequestFilter . ALREADY_FILTERED_SUFFIX , WebRequest . SCOPE_REQUEST ) ; dispatcher . forward ( request , response ) ; return forwardUrl ; }
Forwards a request for the given UrlMappingInfo object and model