*/
protected void processForwardConfig( HttpServletRequest request, HttpServletResponse response, ForwardConfig fwd )
throws IOException, ServletException
{
ServletContext servletContext = getServletContext();
ForwardRedirectHandler fwdRedirectHandler = _handlers.getForwardRedirectHandler();
FlowController fc = PageFlowRequestWrapper.get( request ).getCurrentFlowController();
FlowControllerHandlerContext context = new FlowControllerHandlerContext( request, response, fc );
// Register this module as the one that's handling the action.
if ( fc != null )
{
InternalUtils.setForwardingModule( request, fc.getModulePath() );
}
//
// The following is similar to what's in super.processForwardConfig(), but it avoids putting
// a slash in front of absolute URLs (e.g., ones that start with "http:").
//
if ( fwd != null )
{
if ( LOG.isDebugEnabled() ) LOG.debug( "processForwardConfig(" + fwd + ')' );
//
// Try to process a tiles definition. If the forward doesn't contain a
// a tiles definition, continue on.
//
if ( processTilesDefinition( fwd.getPath(), fwd.getContextRelative(), request, response ) )
{
if ( log.isDebugEnabled() )
{
log.debug( " '" + fwd.getPath() + "' - processed as definition" );
}
return;
}
//
// If this is a "special" page flow forward, create a Forward to handle it and pass
// it to the current page flow. This should only happen when processValidate()
// calls this method (or if a plain Struts action forwards to this forward) --
// otherwise, the page flow should be using a Forward already.
//
if ( fwd instanceof PageFlowActionForward )
{
ActionMapping mapping = ( ActionMapping ) request.getAttribute( Globals.MAPPING_KEY );
assert mapping != null;
ActionForm form = InternalUtils.getFormBean( mapping, request );
Forward pfFwd = new Forward( ( ActionForward ) fwd, servletContext );
ActionForwardHandler handler = _handlers.getActionForwardHandler();
fwd = handler.processForward( context, pfFwd, mapping, null, InternalUtils.getActionName( mapping ),
null, form );
}
String path = fwd.getPath();
boolean startsWithSlash = path.length() > 0 && path.charAt( 0 ) == '/';
//
// If the URI is absolute (e.g., starts with "http:"), do a redirect to it no matter what.
//
if ( FileUtils.isAbsoluteURI( path ) )
{
fwdRedirectHandler.redirect( context, addScopeParams( path, request ) );
}
else if ( fwd.getRedirect() )
{
String redirectURI;
if ( startsWithSlash && fwd instanceof Forward && ( ( Forward ) fwd ).isExplicitPath() )
{
redirectURI = path;
}
else if ( fwd instanceof Forward && ( ( Forward ) fwd ).isExternalRedirect() )
{
assert startsWithSlash : path; // compiler should ensure path starts with '/'
redirectURI = path;
}
else
{
redirectURI = request.getContextPath() + RequestUtils.forwardURL( request, fwd );
}
fwdRedirectHandler.redirect( context, addScopeParams( redirectURI, request ) );
}
else
{
String fwdURI;