Package org.apache.struts.action

Examples of org.apache.struts.action.RequestProcessor


    PageFlowRequestProcessor getRequestProcessor()
    {
        ModuleConfig mc = getModuleConfig();
        String key = Globals.REQUEST_PROCESSOR_KEY + mc.getPrefix();
        RequestProcessor rp = ( RequestProcessor ) getServletContext().getAttribute( key );

        //
        // The RequestProcessor may not have been initialized -- if so, just return a new (temporary) one.
        //
        if ( rp == null )
        {
            try
            {
                ControllerConfig cc = mc.getControllerConfig();
                rp = ( RequestProcessor ) RequestUtils.applicationInstance( cc.getProcessorClass() );
                rp.init( InternalUtils.getActionServlet( getServletContext() ), mc );
            }
            catch ( Exception e )
            {
                _log.error( "Could not initialize request processor for module " + mc.getPrefix(), e );
            }
        }

        assert rp == null || rp instanceof PageFlowRequestProcessor : rp.getClass().getName();
        return ( PageFlowRequestProcessor ) rp;
    }
View Full Code Here


                                                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
View Full Code Here

                                             ModuleConfig modConfig) {

        if (log.isDebugEnabled()) {
            log.debug("Configuring RequestProcessor instance");
        }
        RequestProcessor processor = new FacesRequestProcessor();
        try {
            processor.init(servlet, modConfig);
            servlet.getServletContext().setAttribute
                (Globals.REQUEST_PROCESSOR_KEY + modConfig.getPrefix(),
                 processor);
        } catch (Exception e) {
            log.error("createProcessor()", e);
View Full Code Here

                request.getAttribute(Globals.MODULE_KEY);
            if (log.isTraceEnabled()) {
                log.trace("Assigned to module with prefix '" +
                          moduleConfig.getPrefix() + "'");
            }
            RequestProcessor processor =
                getRequestProcessor(moduleConfig, servletContext);
            if (log.isTraceEnabled()) {
                log.trace("Invoking request processor instance " + processor);
            }
            processor.process(request, response);
            context.responseComplete();
        } catch (Exception e) {
            log.error("Exception processing action event " + event, e);
        } finally {
            request.removeAttribute(Constants.ACTION_EVENT_KEY);
View Full Code Here

     */
    protected RequestProcessor getRequestProcessor(ModuleConfig config,
                                                   ServletContext context) {
           
        String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix();
        RequestProcessor processor =
            (RequestProcessor) context.getAttribute(key);
           
        if (processor == null) {
            try {
                if (log.isDebugEnabled()) {
                    log.debug("Instantiating RequestProcessor of class " +
                              config.getControllerConfig().getProcessorClass());
                }
                ActionServlet servlet = (ActionServlet)
                context.getAttribute(Globals.ACTION_SERVLET_KEY);
                processor =
                    (RequestProcessor) RequestUtils.applicationInstance(
                        config.getControllerConfig().getProcessorClass());
                processor.init(servlet, config);
                context.setAttribute(key, processor);
            } catch (Exception e) {
                log.error("Cannot instantiate RequestProcessor of class "
                          + config.getControllerConfig().getProcessorClass(),
                          e);
View Full Code Here

                request.getAttribute(Globals.MODULE_KEY);
            if (log.isTraceEnabled()) {
                log.trace("Assigned to module with prefix '" +
                          moduleConfig.getPrefix() + "'");
            }
            RequestProcessor processor = (RequestProcessor)
                servletContext.getAttribute
                (Globals.REQUEST_PROCESSOR_KEY + moduleConfig.getPrefix());
            if (log.isTraceEnabled()) {
                log.trace("Invoking request processor instance " + processor);
            }
            processor.process(request, response);
        } catch (Exception e) {
            log.error("Exception processing action event " + event, e);
        } finally {
            request.removeAttribute(Constants.ACTION_EVENT_KEY);
        }
View Full Code Here

            HttpServletResponse response = (HttpServletResponse)
                context.getServletResponse();
            RequestUtils.selectApplication(request, servletContext);
            ModuleConfig modConfig = (ModuleConfig)
                request.getAttribute(Action.APPLICATION_KEY);
            RequestProcessor processor = (RequestProcessor)
                servletContext.getAttribute
                (Action.REQUEST_PROCESSOR_KEY + modConfig.getPrefix());
            if (log.isTraceEnabled()) {
                log.trace("Invoking request processor instance " + processor);
            }
            processor.process(request, response);
        } catch (Exception e) {
            log.error("Exception processing form event " + event, e);
        }

        // Remove the FormEvent request attribute
View Full Code Here

                                             ModuleConfig modConfig) {

        if (log.isDebugEnabled()) {
            log.debug("Configuring RequestProcessor instance");
        }
        RequestProcessor processor = new FacesRequestProcessor();
        try {
            processor.init(servlet, modConfig);
            servlet.getServletContext().setAttribute
                (Action.REQUEST_PROCESSOR_KEY + modConfig.getPrefix(),
                 processor);
        } catch (Exception e) {
            log.error("createProcessor()", e);
View Full Code Here

                request.getAttribute(Globals.MODULE_KEY);
            if (log.isTraceEnabled()) {
                log.trace("Assigned to module with prefix '" +
                          moduleConfig.getPrefix() + "'");
            }
            RequestProcessor processor =
                getRequestProcessor(moduleConfig, servletContext);
            if (log.isTraceEnabled()) {
                log.trace("Invoking request processor instance " + processor);
            }
            processor.process(request, response);
            context.responseComplete();
        } catch (Exception e) {
            log.error("Exception processing action event " + event, e);
        } finally {
            request.removeAttribute(Constants.ACTION_EVENT_KEY);
View Full Code Here

     */
    protected RequestProcessor getRequestProcessor(ModuleConfig config,
                                                   ServletContext context) {

        String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix();
        RequestProcessor processor =
            (RequestProcessor) context.getAttribute(key);

        if (processor == null) {
            try {
                if (log.isDebugEnabled()) {
                    log.debug("Instantiating RequestProcessor of class " +
                              config.getControllerConfig().getProcessorClass());
                }
                ActionServlet servlet = (ActionServlet)
                context.getAttribute(Globals.ACTION_SERVLET_KEY);
                processor =
                    (RequestProcessor) RequestUtils.applicationInstance(
                        config.getControllerConfig().getProcessorClass());
                processor.init(servlet, config);
                context.setAttribute(key, processor);
            } catch (Exception e) {
                log.error("Cannot instantiate RequestProcessor of class "
                          + config.getControllerConfig().getProcessorClass(),
                          e);
View Full Code Here

TOP

Related Classes of org.apache.struts.action.RequestProcessor

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.