Package org.g4studio.core.mvc.xstruts.config

Examples of org.g4studio.core.mvc.xstruts.config.ModuleConfig


   * @return The module configuration object for the currently selected
   *         module.
   * @since Struts 1.1
   */
  protected ModuleConfig getModuleConfig(HttpServletRequest request) {
    ModuleConfig config = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);

    if (config == null) {
      config = (ModuleConfig) getServletContext().getAttribute(Globals.MODULE_KEY);
    }

View Full Code Here


      log.debug("Initializing module path '" + prefix + "' configuration from '" + paths + "'");
    }

    // Parse the configuration for this module
    ModuleConfigFactory factoryObject = ModuleConfigFactory.createFactory();
    ModuleConfig config = factoryObject.createModuleConfig(prefix);

    // Configure the Digester instance we will use
    Digester digester = initConfigDigester();

    List urls = splitAndResolvePaths(paths);
    URL url;

    for (Iterator i = urls.iterator(); i.hasNext();) {
      url = (URL) i.next();
      digester.push(config);
      this.parseModuleConfigFile(digester, url);
    }

    getServletContext().setAttribute(Globals.MODULE_KEY + config.getPrefix(), config);

    return config;
  }
View Full Code Here

   */
  protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException,
      ServletException {
    ModuleUtils.getInstance().selectModule(request, getServletContext());

    ModuleConfig config = getModuleConfig(request);

    RequestProcessor processor = getProcessorForModule(config);

    if (processor == null) {
      processor = getRequestProcessor(config);
View Full Code Here

      return (false);
    }

    // Acquire configuration objects that we need
    ActionConfig actionConfig = actionCtx.getActionConfig();
    ModuleConfig moduleConfig = actionConfig.getModuleConfig();

    ForwardConfig forwardConfig = null;
    String forward = actionConfig.getForward();

    if (forward != null) {
View Full Code Here

    }

    // Look up the local or global exception handler configuration
    ExceptionConfig exceptionConfig = null;
    ActionConfig actionConfig = actionCtx.getActionConfig();
    ModuleConfig moduleConfig = actionCtx.getModuleConfig();

    if (actionConfig != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("See if actionConfig " + actionConfig + " has an exceptionConfig for "
            + exception.getClass().getName());
      }

      exceptionConfig = actionConfig.findException(exception.getClass());
    } else if (moduleConfig != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("No action yet, see if moduleConfig " + moduleConfig + " has an exceptionConfig "
            + exception.getClass().getName());
      }

      exceptionConfig = moduleConfig.findException(exception.getClass());
    }

    // Handle the exception in the configured manner
    if (exceptionConfig == null) {
      LOG.warn("Unhandled exception", exception);
View Full Code Here

   */
  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 + "'");
    }

View Full Code Here

   * @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);
    }

View Full Code Here

  public boolean execute(ActionContext actionCtx) throws Exception {
    // Identify the matching path for this request
    String path = getPath(actionCtx);

    // Cache the corresponding ActonConfig instance
    ModuleConfig moduleConfig = actionCtx.getModuleConfig();
    ActionConfig actionConfig = moduleConfig.findActionConfig(path);

    if (actionConfig == null) {
      // NOTE Shouldn't this be the responsibility of ModuleConfig?
      // Locate the mapping for unknown paths (if any)
      ActionConfig[] configs = moduleConfig.findActionConfigs();

      for (int i = 0; i < configs.length; i++) {
        if (configs[i].getUnknown()) {
          actionConfig = configs[i];
View Full Code Here

   * @throws ServletException
   *             if an unrecoverable error occurs.
   */
  public void handleRequest(HttpServletRequest request) throws ServletException {
    // Get the app config for the current request.
    ModuleConfig ac = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);

    // Create and configure a DIskFileUpload instance.
    DiskFileUpload upload = new DiskFileUpload();

    // The following line is to support an "EncodingFilter"
View Full Code Here

   * @since Struts 1.1
   */
  protected MessageResources getResources(HttpServletRequest request, String key) {
    // Identify the current module
    ServletContext context = getServlet().getServletContext();
    ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, context);

    // Return the requested message resources instance
    return (MessageResources) context.getAttribute(key + moduleConfig.getPrefix());
  }
View Full Code Here

TOP

Related Classes of org.g4studio.core.mvc.xstruts.config.ModuleConfig

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.