/**
   * Cache the <code>ModuleConfig</code> and <code>MessageResources</code> instances for the
   * sub-application module to be used for processing this request.
   *
   * @param actionCtx The <code>Context</code> for the current request
   * @return <code>false</code> so that processing continues
   * @throws IllegalArgumentException if no valid ModuleConfig or MessageResources can be identified
   *     for this request
   * @throws Exception if thrown by the Action class
   */
  public boolean execute(ActionContext actionCtx) throws Exception {
    String prefix = getPrefix(actionCtx);

    // Cache the corresponding ModuleConfig and MessageResources instances
    ModuleConfig moduleConfig =
        (ModuleConfig) actionCtx.getApplicationScope().get(Globals.MODULE_KEY + prefix);

    if (moduleConfig == null) {
      throw new IllegalArgumentException("No module config for prefix '" + prefix + "'");
    }

    actionCtx.setModuleConfig(moduleConfig);

    String key = Globals.MESSAGES_KEY + prefix;
    MessageResources messageResources = (MessageResources) actionCtx.getApplicationScope().get(key);

    if (messageResources == null) {
      throw new IllegalArgumentException(
          "No message resources found in application scope under " + key);
    }

    actionCtx.setMessageResources(messageResources);

    return (false);
  }
  /**
   * Set common properties on the given <code>ActionContext</code> instance so that commands in the
   * chain can count on their presence. Note that while this method does not require that its
   * argument be an instance of <code>ServletActionContext</code>, at this time many common Struts
   * commands will be expecting to receive an <code>ActionContext</code> which is also a <code>
   * ServletActionContext</code>.
   *
   * @param context The ActionContext we are processing
   */
  protected void initializeActionContext(ActionContext context) {
    if (context instanceof ServletActionContext) {
      ((ServletActionContext) context).setActionServlet(this.servlet);
    }

    context.setModuleConfig(this.moduleConfig);
  }
  /**
   * Check to see if the controller is configured to prevent caching, and if so, request no cache
   * flags to be set.
   *
   * @param actionCtx The <code>Context</code> for the current request
   * @return <code>false</code> so that processing continues
   * @throws Exception if thrown by the Action class
   */
  public boolean execute(ActionContext actionCtx) throws Exception {
    // Retrieve the ModuleConfig instance
    ModuleConfig moduleConfig = actionCtx.getModuleConfig();

    // If the module is configured for no caching, request no caching
    if (moduleConfig.getControllerConfig().getNocache()) {
      requestNoCache(actionCtx);
    }

    return CONTINUE_PROCESSING;
  }
  /**
   * Check to see if the content type is set, and if so, set it for this response.
   *
   * @param actionCtx The <code>Context</code> for the current request
   * @return <code>false</code> so that processing continues
   * @throws Exception if thrown by the Action class
   */
  public boolean execute(ActionContext actionCtx) throws Exception {
    // Retrieve the ModuleConfig instance
    ModuleConfig moduleConfig = actionCtx.getModuleConfig();

    // If the content type is configured, set it for the response
    String contentType = moduleConfig.getControllerConfig().getContentType();

    if (contentType != null) {
      setContentType(actionCtx, contentType);
    }

    return (false);
  }
  /**
   * Process an <code>HttpServletRequest</code> and create the corresponding <code>
   * HttpServletResponse</code>.
   *
   * @param request The servlet request we are processing
   * @param response The servlet response we are creating
   * @throws IOException if an input/output error occurs
   * @throws ServletException if a processing exception occurs
   */
  public void process(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    // Wrap the request in the case of a multipart request
    request = processMultipart(request);

    // Create and populate a Context for this request
    ActionContext context = contextInstance(request, response);

    // Create and execute the command.
    try {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Using processing chain for this request");
      }

      command.execute(context);
    } catch (Exception e) {
      // Execute the exception processing chain??
      throw new ServletException(e);
    }

    // Release the context.
    context.release();
  }