Package org.apache.struts.config

Examples of org.apache.struts.config.ApplicationConfig


                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


        request.setPathElements("/myapp", "/2/noform.do", null, null);
        request.setAttribute(RequestProcessor.INCLUDE_SERVLET_PATH,
                             "/noform.do");
        RequestUtils.selectApplication(request, context);
        ApplicationConfig appConfig = (ApplicationConfig)
            request.getAttribute(Action.APPLICATION_KEY);
        assertNotNull("Selected an application", appConfig);
        assertEquals("Selected correct application",
                     "", appConfig.getPrefix());
        // FIXME - check application resources?

    }
View Full Code Here

        request.setPathElements("/myapp", "/noform.do", null, null);
        request.setAttribute(RequestProcessor.INCLUDE_SERVLET_PATH,
                             "/2/noform.do");
        RequestUtils.selectApplication(request, context);
        ApplicationConfig appConfig = (ApplicationConfig)
            request.getAttribute(Action.APPLICATION_KEY);
        assertNotNull("Selected an application", appConfig);
        assertEquals("Selected correct application",
                     "/2", appConfig.getPrefix());
        // FIXME - check application resources?

    }
View Full Code Here

        ActionFormBean formBean = null;
        ActionForward forward = null;
        ActionMapping mapping = null;

        appConfig = new ApplicationConfig("");
        context.setAttribute(Action.APPLICATION_KEY, appConfig);

        // Forward "external" to "http://jakarta.apache.org/"
        appConfig.addForwardConfig
            (new ActionForward("external", "http://jakarta.apache.org/",
View Full Code Here

    protected void setUpSecondApp() {

        ActionFormBean formBean = null;
        ActionMapping mapping = null;

        appConfig2 = new ApplicationConfig("/2");
        context.setAttribute(Action.APPLICATION_KEY + "/2", appConfig2);

        // Forward "external" to "http://jakarta.apache.org/"
        appConfig2.addForwardConfig
            (new ActionForward("external", "http://jakarta.apache.org/",
View Full Code Here

    // Map to the default module -- direct
    public void testSelectApplication1a() {

        request.setPathElements("/myapp", "/noform.do", null, null);
        RequestUtils.selectApplication(request, context);
        ApplicationConfig appConfig = (ApplicationConfig)
            request.getAttribute(Action.APPLICATION_KEY);
        assertNotNull("Selected an application", appConfig);
        assertEquals("Selected correct application",
                     "", appConfig.getPrefix());
        // FIXME - check application resources?

    }
View Full Code Here

    // Map to the second module -- direct
    public void testSelectApplication1b() {

        request.setPathElements("/myapp", "/2/noform.do", null, null);
        RequestUtils.selectApplication(request, context);
        ApplicationConfig appConfig = (ApplicationConfig)
            request.getAttribute(Action.APPLICATION_KEY);
        assertNotNull("Selected an application", appConfig);
        assertEquals("Selected correct application",
                     "/2", appConfig.getPrefix());
        // FIXME - check application resources?

    }
View Full Code Here

        /* 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)getModuleConfig(request));
    }
View Full Code Here

        /* 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

    protected String getActionMappingURL(String actionName) {

        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

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.