Package org.apache.beehive.netui.pageflow.internal

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


        throws IOException, ServletException
    {
        //
        // First check to see if we're already in a forwarded fallback request.  If so, just bail.
        //
        PageFlowRequestWrapper rw = PageFlowRequestWrapper.get( request );
        if ( rw.getOriginalServletPath() != null ) return false;      
       
        SharedFlowController sharedFlowToTry = null;
        String uriBaseName = ServletUtils.getBaseName( uri );
        int firstDot = uriBaseName.indexOf( '.' );
        int lastDot = uriBaseName.lastIndexOf( '.' );
       
        if ( firstDot != -1 && firstDot != lastDot )
        {
            String sharedFlowName = uriBaseName.substring( 0, firstDot );
           
            try
            {
                RequestContext rc = new RequestContext( request, response );
                Map defaultSharedFlows = FlowControllerFactory.get( getServletContext() ).getDefaultSharedFlows( rc );
               
                if ( defaultSharedFlows != null )
                {
                    sharedFlowToTry = ( SharedFlowController ) defaultSharedFlows.get( sharedFlowName );
                    uriBaseName = uriBaseName.substring( firstDot + 1 );
                }
            }
            catch ( ClassNotFoundException e )
            {
                throw new ServletException( e );
            }
            catch ( InstantiationException e )
            {
                throw new ServletException( e );
            }
            catch ( IllegalAccessException e )
            {
                throw new ServletException( e );
            }
        }
        else
        {
            sharedFlowToTry = FlowControllerFactory.getGlobalApp( request, response, getServletContext() );
        }
       
        //
        // If we couldn't find an appropriate module, try raising the action on the (deprecated) Global.app.
        //
       
        if ( sharedFlowToTry != null )
        {
            InternalStringBuilder sfActionURI = new InternalStringBuilder( sharedFlowToTry.getModulePath() );
            sfActionURI.append( '/' );
            sfActionURI.append( uriBaseName );
            rw.setOriginalServletPath( uri );
            ForwardRedirectHandler frh = _handlers.getForwardRedirectHandler();
            FlowControllerHandlerContext context = new FlowControllerHandlerContext( request, response, null );
            frh.forward( context, sfActionURI.toString() );
            return true;
        }
View Full Code Here


        // see if we've saved view state from the original page.  If so, just restore that.
        //
        if ( request instanceof HttpServletRequest )
        {
            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

    {
        //
        // 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 );
            RequestProcessor requestProcessor = getRequestProcessor( moduleConfig );
            requestProcessor.process( request, response );
        }
        else
        {
           
            //
            // 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
            {
                if ( processUnhandledAction( request, response, servletPath ) ) return;
               
                String originalServletPath = requestWrapper.getOriginalServletPath();
                if ( originalServletPath != null )
                {
                    servletPath = originalServletPath;
                    modulePath = PageFlowUtils.getModulePathForRelativeURI( originalServletPath );
                }
View Full Code Here

        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 );
        as.doGet( wrappedRequest, scopedResponse )// this just calls process() -- same as doPost()

        String returnURI;

        if ( ! scopedResponse.didRedirect() )
View Full Code Here

            //
            // 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

        throws IOException, ServletException
    {
        //
        // First check to see if we're already in a forwarded fallback request.  If so, just bail.
        //
        PageFlowRequestWrapper rw = PageFlowRequestWrapper.get( request );
        if ( rw.getOriginalServletPath() != null ) return false;      
       
        SharedFlowController sharedFlowToTry = null;
        String uriBaseName = ServletUtils.getBaseName( uri );
        int firstDot = uriBaseName.indexOf( '.' );
        int lastDot = uriBaseName.lastIndexOf( '.' );
       
        if ( firstDot != -1 && firstDot != lastDot )
        {
            String sharedFlowName = uriBaseName.substring( 0, firstDot );
           
            try
            {
                RequestContext rc = new RequestContext( request, response );
                Map defaultSharedFlows = FlowControllerFactory.get( getServletContext() ).getDefaultSharedFlows( rc );
               
                if ( defaultSharedFlows != null )
                {
                    sharedFlowToTry = ( SharedFlowController ) defaultSharedFlows.get( sharedFlowName );
                    uriBaseName = uriBaseName.substring( firstDot + 1 );
                }
            }
            catch ( ClassNotFoundException e )
            {
                ServletUtils.throwServletException(e);
            }
            catch ( InstantiationException e )
            {
                ServletUtils.throwServletException(e);
            }
            catch ( IllegalAccessException e )
            {
                ServletUtils.throwServletException(e);
            }
        }
        else
        {
            sharedFlowToTry = FlowControllerFactory.getGlobalApp( request, response, getServletContext() );
        }
       
        //
        // If we couldn't find an appropriate module, try raising the action on the (deprecated) Global.app.
        //
       
        if ( sharedFlowToTry != null )
        {
            InternalStringBuilder sfActionURI = new InternalStringBuilder( sharedFlowToTry.getModulePath() );
            sfActionURI.append( '/' );
            sfActionURI.append( uriBaseName );
            rw.setOriginalServletPath( uri );
            ForwardRedirectHandler frh = _handlers.getForwardRedirectHandler();
            FlowControllerHandlerContext context = new FlowControllerHandlerContext( request, response, null );
            frh.forward( context, sfActionURI.toString() );
            return true;
        }
View Full Code Here

    {
        //
        // 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

        throws IOException, ServletException
    {
        //
        // First check to see if we're already in a forwarded fallback request.  If so, just bail.
        //
        PageFlowRequestWrapper rw = PageFlowRequestWrapper.get( request );
        if ( rw.getOriginalServletPath() != null ) return false;      
       
        SharedFlowController sharedFlowToTry = null;
        String uriBaseName = ServletUtils.getBaseName( uri );
        int firstDot = uriBaseName.indexOf( '.' );
        int lastDot = uriBaseName.lastIndexOf( '.' );
       
        if ( firstDot != -1 && firstDot != lastDot )
        {
            String sharedFlowName = uriBaseName.substring( 0, firstDot );
           
            try
            {
                RequestContext rc = new RequestContext( request, response );
                Map defaultSharedFlows = FlowControllerFactory.get( getServletContext() ).getDefaultSharedFlows( rc );
               
                if ( defaultSharedFlows != null )
                {
                    sharedFlowToTry = ( SharedFlowController ) defaultSharedFlows.get( sharedFlowName );
                    uriBaseName = uriBaseName.substring( firstDot + 1 );
                }
            }
            catch ( ClassNotFoundException e )
            {
                ServletUtils.throwServletException(e);
            }
            catch ( InstantiationException e )
            {
                ServletUtils.throwServletException(e);
            }
            catch ( IllegalAccessException e )
            {
                ServletUtils.throwServletException(e);
            }
        }
        else
        {
            sharedFlowToTry = FlowControllerFactory.getGlobalApp( request, response, getServletContext() );
        }
       
        //
        // If we couldn't find an appropriate module, try raising the action on the (deprecated) Global.app.
        //
       
        if ( sharedFlowToTry != null )
        {
            InternalStringBuilder sfActionURI = new InternalStringBuilder( sharedFlowToTry.getModulePath() );
            sfActionURI.append( '/' );
            sfActionURI.append( uriBaseName );
            rw.setOriginalServletPath( uri );
            ForwardRedirectHandler frh = _handlers.getForwardRedirectHandler();
            FlowControllerHandlerContext context = new FlowControllerHandlerContext( request, response, null );
            frh.forward( context, sfActionURI.toString() );
            return true;
        }
View Full Code Here

    {
        //
        // 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

            //
            // 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

TOP

Related Classes of org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper$State

Copyright © 2018 www.massapicom. 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.