Examples of PageFlowRequestWrapper


Examples of org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper

    {
        //
        // First wrap the request with an object that contains request-scoped values that our runtime uses.  This
        // is faster than sticking everything into attributes on the request (then basically reading from a HashMap).
        //
        PageFlowRequestWrapper requestWrapper = PageFlowRequestWrapper.wrapRequest( request );
        request = requestWrapper;
       
        ServletContext servletContext = getServletContext();
        String modulePath = PageFlowUtils.getModulePathForRelativeURI( InternalUtils.getDecodedServletPath( request ) );
        ModuleConfig registeredApp;
       
        //
        // Get the registered Struts module for the request.
        //
        registeredApp = getModuleConfig( modulePath, request, response );
       
        //
        // If we've dynamically registered a module, then we need to override the base process() behavior to select the
        // module.  Note that we don't want to synchronize the call to process().
        //
        if ( registeredApp != null )
        {
            //
            // Try to select the appropriate Struts module and delegate to its RequestProcessor.
            //
            ModuleConfig moduleConfig = InternalUtils.selectModule( modulePath, request, servletContext );
           
            // If this module came from an abstract page flow controller class, send an error.
            ControllerConfig cc = moduleConfig.getControllerConfig();
            if (cc instanceof PageFlowControllerConfig && ((PageFlowControllerConfig) cc).isAbstract()) {
                InternalUtils.sendDevTimeError( "PageFlow_AbstractPageFlow", null, HttpServletResponse.SC_NOT_FOUND,
                                                request, response, servletContext,
                                                new Object[]{ modulePath } );
                return;
            }
                   
            RequestProcessor requestProcessor = getRequestProcessor( moduleConfig );
            requestProcessor.process( request, response );
        }
        else
        {
            //
            // Here, we're checking to see if this was a module that was registered externally by Struts (not by this
            // servlet).  This is the same as the base process() behavior, but it checks for a missing
            // module-configuration.
            //
            ModuleConfig moduleConfig = null;
           
            if ( InternalUtils.getModuleConfig( RequestUtils.getModuleName( request, servletContext ), servletContext ) != null )
            {
                String modulePrefix = RequestUtils.getModuleName( request, servletContext );
                moduleConfig = InternalUtils.selectModule( modulePrefix, request, servletContext );
            }
           
            String servletPath = InternalUtils.getDecodedServletPath( request );
            RequestProcessor rp = moduleConfig != null ? getRequestProcessor( moduleConfig ) : null;
           
            if ( rp != null && moduleCanHandlePath( moduleConfig, rp, servletPath ) )
            {
                rp.process( request, response );
            }
            else
            {
                //
                // Initialize the ServletContext in the request.  Often, we need access to the ServletContext when we only
                // have a ServletRequest.
                //
                InternalUtils.setServletContext( request, getServletContext() );
               
                if ( processUnhandledAction( request, response, servletPath ) ) return;
               
                String originalServletPath = requestWrapper.getOriginalServletPath();
                if ( originalServletPath != null )
                {
                    servletPath = originalServletPath;
                    modulePath = PageFlowUtils.getModulePathForRelativeURI( originalServletPath );
                }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper

            //
            // If this is a navigateTo=Jpf.NavigateTo.currentPage or a navigateTo=Jpf.NavigateTo.previousPage,
            // see if we've saved view state from the original page.  If so, just restore that.
            //
            httpRequest = ( HttpServletRequest ) request;
            PageFlowRequestWrapper rw = PageFlowRequestWrapper.unwrap( httpRequest );

            if ( rw != null )
            {
                PreviousPageInfo prevPageInfo = rw.getPreviousPageInfo( true );
               
                if ( prevPageInfo != null )
                {
                    Object clientState = prevPageInfo.getClientState();
                   
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper

        scopedRequest.setForwardedURI( null );
       
        //
        // Now process the request.  We create a PageFlowRequestWrapper for pageflow-specific request-scoped info.
        //
        PageFlowRequestWrapper wrappedRequest = PageFlowRequestWrapper.wrapRequest( ( HttpServletRequest ) request );
        wrappedRequest.setScopedLookup( true );

        if (as != null)
        {
            as.doGet( wrappedRequest, scopedResponse )// this just calls process() -- same as doPost()
        }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper

            }
            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 );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.