Package org.apache.struts.config

Examples of org.apache.struts.config.ForwardConfig


     */
    public void testProcessForwardConfigClassNoExtends()
        throws Exception {
        moduleConfig.addForwardConfig(baseForward);

        ForwardConfig result = null;

        try {
            result =
                actionServlet.processForwardConfigClass(baseForward,
                    moduleConfig);
View Full Code Here


     */
    public void testProcessForwardConfigClassSubConfigCustomClass()
        throws Exception {
        moduleConfig.addForwardConfig(baseForward);

        ForwardConfig customSub = new ActionForward();

        customSub.setName("failure");
        customSub.setExtends("success");
        moduleConfig.addForwardConfig(customSub);

        ForwardConfig result =
            actionServlet.processForwardConfigClass(customSub, moduleConfig);

        assertSame("The instance returned should be the param given it.",
            customSub, result);
    }
View Full Code Here

     * Make sure the code throws the correct exception when it can't create an
     * instance of the base config's custom class.
     */
    public void notestProcessForwardConfigClassError()
        throws Exception {
        ForwardConfig customBase =
            new CustomForwardConfigArg("success", "/success.jsp");

        moduleConfig.addForwardConfig(customBase);

        ForwardConfig customSub = new ActionForward();

        customSub.setName("failure");
        customSub.setExtends("success");
        moduleConfig.addForwardConfig(customSub);

        try {
            actionServlet.processForwardConfigClass(customSub, moduleConfig);
            fail("Exception should be thrown");
View Full Code Here

     */
    public void testProcessForwardConfigClassOverriddenSubConfigClass()
        throws Exception {
        moduleConfig.addForwardConfig(baseForward);

        ForwardConfig customSub =
            new CustomForwardConfigArg("failure", "/failure.jsp");

        customSub.setExtends("success");
        moduleConfig.addForwardConfig(customSub);

        try {
            actionServlet.processForwardConfigClass(customSub, moduleConfig);
        } catch (Exception e) {
View Full Code Here

    protected void tearDown() {
    }

    public void testNullForwardPath()
        throws Exception {
        ForwardConfig config = new ForwardConfig();

        config.setPath(null);

        try {
            command.perform(saContext, config);
            fail(
                "Didn't throw an illegal argument exception on null forward path");
View Full Code Here

    // Default module (default forwardPattern)
    public void testForwardURL1() {
        request.setAttribute(Globals.MODULE_KEY, moduleConfig);
        request.setPathElements("/myapp", "/action.do", null, null);

        ForwardConfig forward = null;
        String result = null;

        // redirect=false, module=null
        forward = moduleConfig.findForwardConfig("moduleForward");
        assertNotNull("moduleForward found", forward);
View Full Code Here

    // Second module (default forwardPattern)
    public void testForwardURL2() {
        request.setAttribute(Globals.MODULE_KEY, moduleConfig2);
        request.setPathElements("/myapp", "/2/action.do", null, null);

        ForwardConfig forward = null;
        String result = null;

        // redirect=false, module=null
        forward = moduleConfig2.findForwardConfig("moduleForward");
        assertNotNull("moduleForward found", forward);
View Full Code Here

    // Third module (custom forwardPattern)
    public void testForwardURL3() {
        request.setAttribute(Globals.MODULE_KEY, moduleConfig3);
        request.setPathElements("/myapp", "/3/action.do", null, null);

        ForwardConfig forward = null;
        String result = null;

        // redirect=false, module=null
        forward = moduleConfig3.findForwardConfig("moduleForward");
        assertNotNull("moduleForward found", forward);
View Full Code Here

    // Cross module forwards
    public void testForwardURLa() {
        request.setAttribute(Globals.MODULE_KEY, moduleConfig);
        request.setPathElements("/myapp", "/action.do", null, null);

        ForwardConfig forward = null;
        String result = null;

        // redirect=false, contextRelative=false, link to module 3
        forward = moduleConfig3.findForwardConfig("moduleForward");
        assertNotNull("moduleForward found", forward);
View Full Code Here

        StringBuffer url = new StringBuffer();
        HttpServletRequest request =
            (HttpServletRequest) pageContext.getRequest();

        if (forward != null) {
            ForwardConfig forwardConfig =
                moduleConfig.findForwardConfig(forward);

            if (forwardConfig == null) {
                throw new MalformedURLException(messages.getMessage(
                        "computeURL.forward", forward));
            }

            // **** removed - see bug 37817 ****
            //  if (forwardConfig.getRedirect()) {
            //      redirect = true;
            //  }

            if (forwardConfig.getPath().startsWith("/")) {
                url.append(request.getContextPath());
                url.append(RequestUtils.forwardURL(request, forwardConfig,
                        moduleConfig));
            } else {
                url.append(forwardConfig.getPath());
            }
        } else if (href != null) {
            url.append(href);
        } else if (action != null) {
            url.append(instance.getActionMappingURL(action, module,
View Full Code Here

TOP

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

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.