}
if (TemplatedURLFormatter.getTemplatedURLFormatter(request) == null) {
TemplatedURLFormatter.initServletRequest(request, TemplatedURLFormatter.getTemplatedURLFormatter(_servletContext));
}
PageFlowRequestWrapper rw = PageFlowRequestWrapper.unwrap( request );
boolean isForwardedRequest = rw != null && rw.isForwardedRequest();
//
// Below, runPage() will try to synchronize on the current page flow.
// If we're in a JSP included from another JSP of this page flow, we
// don't want to commit any session-scoped changes with the
// storage handler because the locking order will get reversed.
// See BEEHIVE-1135 in Jira
//
boolean commitChanges = true;
String commitChangesAttrName = null;
try
{
ModuleConfig prevModuleConfig = RequestUtils.getRequestModuleConfig( httpRequest );
MessageResources prevMessageResources = ( MessageResources ) request.getAttribute( Globals.MESSAGES_KEY );
//
// Ensure that the right Struts module is selected, for use by the tags.
//
boolean noModuleConfig = false;
if ( rw == null || ! rw.isStayInCurrentModule() ) {
// Dynamically register the Struts module, if appropriate. If there's no
// module config for a given path do not continue to try and register it.
// Performance fix until we implement a better caching layer for getting
// module configs, etc.
//
// Note that two threads could potentially get here at the same time, and
// both will save the module path. This is OK -- reads from _knownModulePaths
// are consistent, and the worst that will happen is that ensureModuleConfig()
// will get called and the module path will get set a few times.
String curModulePath = PageFlowUtils.getModulePath( httpRequest );
String registered = (String) _knownModulePaths.get(curModulePath);
if (registered == null) {
ModuleConfig mc = InternalUtils.ensureModuleConfig(curModulePath, _servletContext);
if (mc == null) {
_knownModulePaths.put(curModulePath, NO_MODULE_CONFIG);
noModuleConfig = true;
}
else {
_knownModulePaths.put(curModulePath, curModulePath);
}
}
else if (NO_MODULE_CONFIG.equals(registered)) {
noModuleConfig = true;
}
InternalUtils.selectModule(curModulePath, httpRequest, _servletContext);
}
try
{
//
// Initialize shared flows for the current request.
//
Map/*< String, SharedFlowController >*/ sharedFlows =
_flowControllerFactory.getSharedFlowsForRequest( requestContext );
ImplicitObjectUtil.loadSharedFlow( request, sharedFlows );
ImplicitObjectUtil.loadGlobalApp( request, PageFlowUtils.getGlobalApp( httpRequest ) );
//
// Make sure that the current PageFlowController is set up for this request.
//
PageFlowController curJpf = null;
if ( rw != null && rw.isStayInCurrentModule() )
{
rw.setStayInCurrentModule( false );
curJpf = PageFlowUtils.getCurrentPageFlow( httpRequest, _servletContext );
}
else if ( !noModuleConfig )
{
curJpf = _flowControllerFactory.getPageFlowForRequest( requestContext );