Package org.apache.struts.config

Examples of org.apache.struts.config.ApplicationConfig


        /* FIXME for Struts 1.2
           Since Struts 1.1 only has one implementation for
           ModuleConfig casting is safe here. Used only for
           transition purposes !
        */
        return new ApplicationConfig((ModuleConfigImpl)initModuleConfig(prefix,path));
    }
View Full Code Here


     * If the request argument is an instance of MultipartRequestWrapper,
     * the request wrapper will be populated as well.
     */
    public void handleRequest(HttpServletRequest request) throws ServletException
    {
        ApplicationConfig appConfig = (ApplicationConfig) request.getAttribute(Action.APPLICATION_KEY);
        retrieveTempDir(appConfig);
        try
        {
            MultipartIterator iterator = new MultipartIterator(request, appConfig.getControllerConfig().getBufferSize(),
                                                               getMaxSize(appConfig.getControllerConfig().getMaxFileSize()),
                                                               tempDir);
            MultipartElement element;

            textElements = new Hashtable();
            fileElements = new Hashtable();
View Full Code Here

     * Process the end tag by including the template.
     */
   public int doEndTag() throws JspException {

      String prefix = "";
      ApplicationConfig config = (ApplicationConfig)
          pageContext.getServletContext().getAttribute(Action.APPLICATION_KEY);
      if (config != null) {
          prefix = config.getPrefix();
      }
      try {
         pageContext.include(prefix + template);
      } catch (IOException ex) {
        saveException(ex);
View Full Code Here

            RequestUtils.saveException(pageContext, e);
            throw e;
        }

        // Retrieve our application configuration information
        ApplicationConfig config = (ApplicationConfig)
            pageContext.getRequest().getAttribute(Action.APPLICATION_KEY);
        if (config == null) { // Backwards compatibility hack
            config = (ApplicationConfig)
                pageContext.getServletContext().getAttribute
                (Action.APPLICATION_KEY);
        }

        // Retrieve the requested object to be exposed
        Object object = null;
        String selector = null;
        if (formBean != null) {
            selector = formBean;
            object = config.findFormBeanConfig(formBean);
        } else if (forward != null) {
            selector = forward;
            object = config.findForwardConfig(forward);
        } else if (mapping != null) {
            selector = mapping;
            object = config.findActionConfig(mapping);
        }
        if (object == null) {
            JspException e = new JspException
                (messages.getMessage("struts.missing", selector));
            RequestUtils.saveException(pageContext, e);
View Full Code Here

     */
    public int doEndTag() throws JspException {

  // Look up the desired ActionForward entry
  ActionForward forward = null;
        ApplicationConfig config = (ApplicationConfig)
            pageContext.getRequest().getAttribute(Action.APPLICATION_KEY);
        if (config == null) { // Backwards compatibility hack
            config = (ApplicationConfig)
                pageContext.getServletContext().getAttribute
                (Action.APPLICATION_KEY);
        }
  if (config != null)
      forward = (ActionForward) config.findForwardConfig(name);
  if (forward == null) {
            JspException e = new JspException
    (messages.getMessage("forward.lookup", name));
            RequestUtils.saveException(pageContext, e);
            throw e;
View Full Code Here

        initOther();
        initServlet();

        // Initialize sub-applications as needed
        getServletContext().setAttribute(Action.ACTION_SERVLET_KEY, this);
        ApplicationConfig ac = initApplicationConfig("", config);
        initApplicationMessageResources(ac);
        initApplicationDataSources(ac);
        initApplicationPlugIns(ac);
        Enumeration names = getServletConfig().getInitParameterNames();
        while (names.hasMoreElements()) {
View Full Code Here

        Iterator keys = values.iterator();
        while (keys.hasNext()) {
            String name = (String) keys.next();
            Object value = getServletContext().getAttribute(name);
            if (value instanceof ApplicationConfig) {
                ApplicationConfig config = (ApplicationConfig) value;
                try {
                    config.getProcessor().destroy();
                } catch (Throwable t) {
                    ;
                }
                PlugIn plugIns[] = config.findPlugIns();
                for (int i = 0; i < plugIns.length; i++) {
                    int j = plugIns.length - (i + 1);
                    plugIns[j].destroy();
                }
            }
View Full Code Here

     * @param request The servlet request we are processing
     */
    protected ApplicationConfig getApplicationConfig
        (HttpServletRequest request) {

        ApplicationConfig config = (ApplicationConfig)
            request.getAttribute(Action.APPLICATION_KEY);
        if (config == null) {
            config = (ApplicationConfig)
                getServletContext().getAttribute(Action.APPLICATION_KEY);
        }
View Full Code Here

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

        // Parse the application configuration for this application
        ApplicationConfig config = null;
        InputStream input = null;
        String mapping = null;
        try {
            config = new ApplicationConfig(prefix, this);

            // Support for application-wide ActionMapping override
            mapping = getServletConfig().getInitParameter("mapping");
            if (mapping != null) {
                config.setActionMappingClass(mapping);
            }

            Digester digester = initConfigDigester();
            digester.push(config);
            input = getServletContext().getResourceAsStream(path);
            digester.parse(input);
            input.close();
            getServletContext().setAttribute
                (Action.APPLICATION_KEY + prefix, config);
        } catch (Throwable t) {
            log.error(internal.getMessage("configParse", path), t);
            throw new UnavailableException
                (internal.getMessage("configParse", path));
        } finally {
            if (input != null) {
                try {
                    input.close();
                } catch (IOException e) {
                    ;
                }
            }
        }

        // Special handling for the default sub-application (for
        // backwards compatibility only, will be removed later)
        if (prefix.length() < 1) {
            defaultControllerConfig(config);
            defaultMessageResourcesConfig(config);
            defaultFormBeansConfig(config);
            defaultForwardsConfig(config);
            defaultMappingsConfig(config);
        }

        // Return the completed configuration object
        config.freeze();
        return (config);

    }
View Full Code Here

                JspException e = new JspException
                    (messages.getMessage("imgTag.src"));
                RequestUtils.saveException(pageContext, e);
                throw e;
            }
            ApplicationConfig config = (ApplicationConfig)
                pageContext.getRequest().getAttribute(Action.APPLICATION_KEY);
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();
            if (config == null) {
                return (request.getContextPath() + this.page);
            } else {
                return (request.getContextPath() + config.getPrefix() +
                        this.page);
            }
        }

        // Deal with an indirect context-relative page that has been specified
        if (this.pageKey != null) {
            if ((this.src != null) || (this.srcKey != null)) {
                JspException e = new JspException
                    (messages.getMessage("imgTag.src"));
                RequestUtils.saveException(pageContext, e);
                throw e;
            }
            ApplicationConfig config = (ApplicationConfig)
                pageContext.getRequest().getAttribute(Action.APPLICATION_KEY);
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();
            if (config == null) {
                return (request.getContextPath() +
                        RequestUtils.message(pageContext, getBundle(),
                                             getLocale(), this.pageKey));
            } else {
                return (request.getContextPath() + config.getPrefix() +
                        RequestUtils.message(pageContext, getBundle(),
                                             getLocale(), this.pageKey));
            }
        }
View Full Code Here

TOP

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

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.