Search in sources :

Example 1 with ControllerConfig

use of org.apache.struts.config.ControllerConfig in project sonarqube by SonarSource.

the class TestMockBase method setUpThirdApp.

// Set up third app for testing URL mapping
protected void setUpThirdApp() {
    ModuleConfigFactory factoryObject = ModuleConfigFactory.createFactory();
    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", // No redirect, same module
    false));
    moduleConfig3.addForwardConfig(new ForwardConfig("moduleRedirect", "/module/redirect", // Redirect, same module
    true));
    moduleConfig3.addForwardConfig(new ForwardConfig("contextForward", // No redirect
    "/forward", // No redirect
    false, // Specify module
    "/context"));
    moduleConfig3.addForwardConfig(new ForwardConfig("contextRedirect", // Redirect
    "/redirect", // Redirect
    true, // Specify module
    "/context"));
    moduleConfig3.addForwardConfig(new ForwardConfig("moduleNoslash", "module/noslash", // No redirect, same module
    false));
    moduleConfig3.addForwardConfig(new ForwardConfig("contextNoslash", // No redirect
    "noslash", // No redirect
    false, // specify module
    "/context"));
}
Also used : ModuleConfigFactory(org.apache.struts.config.ModuleConfigFactory) ControllerConfig(org.apache.struts.config.ControllerConfig) ForwardConfig(org.apache.struts.config.ForwardConfig)

Example 2 with ControllerConfig

use of org.apache.struts.config.ControllerConfig in project sonarqube by SonarSource.

the class ComposableRequestProcessor method init.

/**
     * <p>Initialize this request processor instance.</p>
     *
     * @param servlet      The ActionServlet we are associated with
     * @param moduleConfig The ModuleConfig we are associated with.
     * @throws ServletException If an error occurs during initialization
     */
public void init(ActionServlet servlet, ModuleConfig moduleConfig) throws ServletException {
    LOG.info("Initializing composable request processor for module prefix '" + 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));
}
Also used : ServletException(javax.servlet.ServletException) ControllerConfig(org.apache.struts.config.ControllerConfig)

Aggregations

ControllerConfig (org.apache.struts.config.ControllerConfig)2 ServletException (javax.servlet.ServletException)1 ForwardConfig (org.apache.struts.config.ForwardConfig)1 ModuleConfigFactory (org.apache.struts.config.ModuleConfigFactory)1