Package org.apache.struts.config

Examples of org.apache.struts.config.ControllerConfig


    } catch (ConfigException e) {
      throw new ServletException(e);
    }
   
    // we have to use a modified request processor
    ControllerConfig controllerConfig = moduleConfig.getControllerConfig();
    String processor = controllerConfig.getProcessorClass();
    if (processor == null || processor.equals(RequestProcessor.class.getName())) {
      controllerConfig.setProcessorClass(PanelsRequestProcessor.class.getName());
    } else {
      // assert processor to be a subclass of PanelsRequestProcessor
      // or ComposableRequestProcessor (since struts 1.3)
      Class clazz = null;
      try {
View Full Code Here


     */
    protected void initRequestProcessorClass(ModuleConfig config)
        throws ServletException {

        String tilesProcessorClassname = TilesRequestProcessor.class.getName();
        ControllerConfig ctrlConfig = config.getControllerConfig();
        String configProcessorClassname = ctrlConfig.getProcessorClass();

        // Check if specified classname exist
        Class configProcessorClass;
        try {
            configProcessorClass =
                RequestUtils.applicationClass(configProcessorClassname);

        } catch (ClassNotFoundException ex) {
            log.fatal(
                "Can't set TilesRequestProcessor: bad class name '"
                    + configProcessorClassname
                    + "'.");
            throw new ServletException(ex);
        }

        // Check to see if request processor uses struts-chain.  If so,
        // no need to replace the request processor.
        if (ComposableRequestProcessor.class.isAssignableFrom(configProcessorClass)) {
            return;
        }

        // Check if it is the default request processor or Tiles one.
        // If true, replace by Tiles' one.
        if (configProcessorClassname.equals(RequestProcessor.class.getName())
            || configProcessorClassname.endsWith(tilesProcessorClassname)) {

            ctrlConfig.setProcessorClass(tilesProcessorClassname);
            return;
        }

        // Check if specified request processor is compatible with Tiles.
        Class tilesProcessorClass = TilesRequestProcessor.class;
View Full Code Here

        moduleConfig3 = factoryObject.createModuleConfig("/3");

        context.setAttribute(Globals.MODULE_KEY + "/3", moduleConfig3);

        // Instantiate the controller configuration for this app
        ControllerConfig controller = new ControllerConfig();

        moduleConfig3.setControllerConfig(controller);

        // Configure the properties we will be testing
        controller.setForwardPattern("/forwarding$M$P");
        controller.setInputForward(true);
        controller.setPagePattern("/paging$M$P");

        // Configure global forward declarations
        moduleConfig3.addForwardConfig(new ForwardConfig("moduleForward",
                "/module/forward", false)); // No redirect, same module
View Full Code Here

            + moduleConfig.getPrefix() + "'");
        super.init(servlet, moduleConfig);

        initCatalogFactory(servlet, moduleConfig);

        ControllerConfig controllerConfig = moduleConfig.getControllerConfig();

        String catalogName = controllerConfig.getCatalog();

        catalog = this.catalogFactory.getCatalog(catalogName);

        if (catalog == null) {
            throw new ServletException("Cannot find catalog '" + catalogName
                + "'");
        }

        String commandName = controllerConfig.getCommand();

        command = catalog.getCommand(commandName);

        if (command == null) {
            throw new ServletException("Cannot find command '" + commandName
                + "'");
        }

        this.setActionContextClassName(controllerConfig.getProperty(
                ACTION_CONTEXT_CLASS));
    }
View Full Code Here

    /**
     * <p>The controller configuration object for this module.</p>
     */
    public ControllerConfig getControllerConfig() {
        if (this.controllerConfig == null) {
            this.controllerConfig = new ControllerConfig();
        }

        return (this.controllerConfig);
    }
View Full Code Here

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

        ModuleConfig mc = InternalUtils.ensureModuleConfig( parentDir, request, getServletContext() );
        LinkedHashMap/*< String, SharedFlowController >*/ sharedFlows = getDefaultSharedFlows( context );

        if ( mc != null )
        {
            ControllerConfig cc = mc.getControllerConfig();

            if ( cc instanceof PageFlowControllerConfig )
            {
                Map/*< String, String >*/ sharedFlowTypes = ( ( PageFlowControllerConfig ) cc ).getSharedFlowTypes();

View Full Code Here

        configDigester = null;

        //
        // If this is a FlowController module, make a callback to the event reporter.
        //
        ControllerConfig cc = ac.getControllerConfig();
        if ( cc instanceof PageFlowControllerConfig )
        {
            PageFlowControllerConfig pfcc = ( PageFlowControllerConfig ) cc;
            PageFlowEventReporter er = AdapterManager.getServletContainerAdapter( getServletContext() ).getEventReporter();
            er.flowControllerRegistered( modulePath, pfcc.getControllerClass(), ac );
View Full Code Here

     * @deprecated Will be removed in a release after Struts 1.1.
     */
    private void defaultControllerConfig(ModuleConfig config) {

        String value = null;
        ControllerConfig cc = config.getControllerConfig();
       
        value = getServletConfig().getInitParameter("bufferSize");
        if (value != null) {
            cc.setBufferSize(Integer.parseInt(value));
        }
       
        value = getServletConfig().getInitParameter("content");
        if (value != null) {
            cc.setContentType(value);
        }
       
        value = getServletConfig().getInitParameter("locale");       
        // must check for null here
        if (value != null) {
            if ("true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value)) {
                cc.setLocale(true);
            } else {
                cc.setLocale(false);
            }
        }
       
        value = getServletConfig().getInitParameter("maxFileSize");
        if (value != null) {
            cc.setMaxFileSize(value);
        }
       
        value = getServletConfig().getInitParameter("nocache");
        if (value != null) {
            if ("true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value)) {
                cc.setNocache(true);
            } else {
                cc.setNocache(false);
            }
        }
       
        value = getServletConfig().getInitParameter("multipartClass");
        if (value != null) {
            cc.setMultipartClass(value);
        }
       
        value = getServletConfig().getInitParameter("tempDir");
        if (value != null) {
            cc.setTempDir(value);
        }

    }
View Full Code Here

        return mc != null ? getFlowControllerClassName( mc ) : null;
    }

    public static String getFlowControllerClassName( ModuleConfig mc )
    {
        ControllerConfig cc = mc.getControllerConfig();
        return cc instanceof PageFlowControllerConfig ? ( ( PageFlowControllerConfig ) cc ).getControllerClass() : null;
    }
View Full Code Here

TOP

Related Classes of org.apache.struts.config.ControllerConfig

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.