Package org.apache.struts.config

Examples of org.apache.struts.config.ApplicationConfig


    protected String getActionMappingURL() {

        HttpServletRequest request =
            (HttpServletRequest) pageContext.getRequest();
        StringBuffer value = new StringBuffer(request.getContextPath());
        ApplicationConfig config = (ApplicationConfig)
            pageContext.getRequest().getAttribute(Action.APPLICATION_KEY);
        if (config != null) {
            value.append(config.getPrefix());
        }
       
        // Use our servlet mapping, if one is specified
        String servletMapping = (String)
            pageContext.getAttribute(Action.SERVLET_KEY,
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

            throw new MalformedURLException
                (messages.getMessage("computeURL.specifier"));
        }

        // Look up the application configuration for this request
        ApplicationConfig config = (ApplicationConfig)
            pageContext.getRequest().getAttribute(Action.APPLICATION_KEY);
        if (config == null) { // Backwards compatibility hack
            config = (ApplicationConfig)
                pageContext.getServletContext().getAttribute
                (Action.APPLICATION_KEY);
        }

        // Calculate the appropriate URL
        StringBuffer url = new StringBuffer();
        HttpServletRequest request =
            (HttpServletRequest) pageContext.getRequest();
        if (forward != null) {
            ActionForward af =
                (ActionForward) config.findForwardConfig(forward);
            if (af == null) {
                throw new MalformedURLException
                    (messages.getMessage("computeURL.forward", forward));
            }
            if (af.getRedirect()) {
                redirect = true;
            }
            if (af.getPath().startsWith("/")) {
                url.append(request.getContextPath());
                if ((config != null) && !af.getContextRelative()) {
                    url.append(config.getPrefix());
                }
            }
            url.append(af.getPath());
        } else if (href != null) {
            url.append(href);
        } else /* if (page != null) */ {
            url.append(request.getContextPath());
            if (config != null) {
                url.append(config.getPrefix());
            }
            url.append(page);
        }

        // Add anchor if requested (replacing any existing anchor)
View Full Code Here

            if (multipartHandler != null)
                return multipartHandler;
        }

        ApplicationConfig appConfig = (ApplicationConfig)
            request.getAttribute(Action.APPLICATION_KEY);
        multipartClass = appConfig.getControllerConfig().getMultipartClass();

        // Try to initialize the global request handler
        if (multipartClass != null) {
            try {
                multipartHandler = (MultipartRequestHandler)
View Full Code Here

                break;
            }
        }

        // Expose the resources for this sub-application
        ApplicationConfig config = (ApplicationConfig)
            context.getAttribute(Action.APPLICATION_KEY + prefix);
        if (config != null)
            request.setAttribute(Action.APPLICATION_KEY, config);
        MessageResources resources = (MessageResources)
            context.getAttribute(Action.MESSAGES_KEY + prefix);
View Full Code Here

        while (names.hasMoreElements()) {
            String name = (String) names.nextElement();
            if (!name.startsWith(Action.APPLICATION_KEY)) {
                continue;
            }
            ApplicationConfig config = (ApplicationConfig)
                context.getAttribute(name);
            String prefix = name.substring(Action.APPLICATION_KEY.length());
            if (prefix.length() > 0) {
                list.add(prefix);
            }
View Full Code Here

     */
    public void handleRequest(HttpServletRequest request)
            throws ServletException {

        // Get the app config for the current request.
        ApplicationConfig ac = (ApplicationConfig) request.getAttribute(
                Action.APPLICATION_KEY);

        // Create and configure a FileUpload instance.
        FileUpload upload = new FileUpload();
        // Set the maximum size before a FileUploadException will be thrown.
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

    protected DataSource getDataSource(HttpServletRequest request,
                                       String key) {

        // Identify the current application module
        ServletContext context = getServlet().getServletContext();
        ApplicationConfig appConfig = (ApplicationConfig)
            request.getAttribute(Action.APPLICATION_KEY);
        if (appConfig == null) {
            appConfig = (ApplicationConfig)
                context.getAttribute(Action.APPLICATION_KEY);
        }

        // Return the requested data source instance
        return ((DataSource) context.getAttribute
                (key + appConfig.getPrefix()));

    }
View Full Code Here

    protected MessageResources getResources(HttpServletRequest request,
                                            String key) {

        // Identify the current application module
        ServletContext context = getServlet().getServletContext();
        ApplicationConfig appConfig = (ApplicationConfig)
            request.getAttribute(Action.APPLICATION_KEY);
        if (appConfig == null) {
            appConfig = (ApplicationConfig)
                context.getAttribute(Action.APPLICATION_KEY);
        }

        // Return the requested message resources instance
        return ((MessageResources) context.getAttribute
                (key + appConfig.getPrefix()));

    }
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.