protected boolean processActionOverride ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { // Only make this check if this is an initial (non-forwarded) request. // // TODO: performance? // PageFlowRequestWrapper wrapper = PageFlowRequestWrapper . get ( request ) ; if ( ! wrapper . isForwardedByButton ( ) && ! wrapper . isForwardedRequest ( ) ) { // // First, since we need access to request parameters here, process a multipart request // if that's what we have. This puts the parameters (each in a MIME part) behind an // interface that makes them look like normal request parameters. // HttpServletRequest multipartAwareRequest = processMultipart ( request ) ; for ( Enumeration e = multipartAwareRequest . getParameterNames ( ) ; e . hasMoreElements ( ) ; ) { String paramName = ( String ) e . nextElement ( ) ; if ( paramName . startsWith ( ACTION_OVERRIDE_PARAM_PREFIX ) ) { String actionPath = paramName . substring ( ACTION_OVERRIDE_PARAM_PREFIX_LEN ) ; ServletContext servletContext = getServletContext ( ) ; String qualifiedAction = InternalUtils . qualifyAction ( servletContext , actionPath ) ; actionPath = InternalUtils . createActionPath ( request , qualifiedAction ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "A request parameter overrode the action. Forwarding to: " + actionPath ) ; } wrapper . setForwardedByButton ( true ) ; doForward ( actionPath , request , response ) ; return true ; } } } return false ; }
The requested action can be overridden by a request parameter . In this case we parse the action from the request parameter and forward to a URI constructed from it .