Package org.apache.struts.config

Examples of org.apache.struts.config.ForwardConfig


   * @throws ServletException
   * @throws IOException
   */
  public boolean execute(Context ctx) throws ServletException, IOException {
    ServletActionContext context = (ServletActionContext)ctx;
    ForwardConfig forward = context.getForwardConfig();
    if (forward == null || forward.getPath() == null || forward.getRedirect()) {
      return false;
    }
    if (forward.getModule() != null && !forward.getModule().equals(context.getModuleConfig().getPrefix())) {
      return false;
    }
    HttpServletRequest request = context.getRequest();
    PanelsSupport support = PanelsSupport.getInstance(request);
    Locale locale = I18nSupport.getInstance(request).getLocale(request);
    PanelConfig panel = support.findPanelConfig(forward.getPath(), locale);
    if (panel != null) {
      String template = panel.findTemplate(locale);
      if (template == null) {
        throw new ServletException("Cannot find template for panel " + panel.getName());
      }
View Full Code Here


     */
    public boolean execute(Context context) throws Exception {

        // Is there a Tiles Definition to be processed?
        ServletActionContext sacontext = (ServletActionContext) context;
        ForwardConfig forwardConfig = sacontext.getForwardConfig();
        if (forwardConfig == null || forwardConfig.getPath() == null)
        {
            log.debug("No forwardConfig or no path, so pass to next command.");
            return (false);
        }


        ComponentDefinition definition = null;
        try
        {
            definition = TilesUtil.getDefinition(forwardConfig.getPath(),
                    sacontext.getRequest(),
                    sacontext.getContext());
        }
        catch (FactoryNotFoundException ex)
        {
View Full Code Here

        ActionConfig actionConfig =
            (ActionConfig)request.getAttribute(Globals.MAPPING_KEY);

        // NOTE: ActionConfig.findForwardConfig only searches local forwards
        ForwardConfig fc = null;
        if(actionConfig != null)
        {
            fc = actionConfig.findForwardConfig(forward);

            // No ActionConfig forward?
            // Find the ForwardConfig in the global-forwards.
            if(fc == null)
            {
                fc = moduleConfig.findForwardConfig(forward);

                // ok, give up
                if (fc == null)
                {
                    return null;
                }
            }
        }

        StringBuffer url = new StringBuffer();
        if (fc.getPath().startsWith("/"))
        {
            url.append(request.getContextPath());
            url.append(RequestUtils.forwardURL(request, fc, moduleConfig));
        }
        else
        {
            url.append(fc.getPath());
        }
        return url.toString();
    }
View Full Code Here

        mapping.setPath("/noform");
        mapping.setType("org.apache.struts.mock.MockAction");
        moduleConfig.addActionConfig(mapping);

        // Configure global forward declarations
        moduleConfig.addForwardConfig(new ForwardConfig("moduleForward",
                "/module/forward", false)); // No redirect, same module

        moduleConfig.addForwardConfig(new ForwardConfig("moduleRedirect",
                "/module/redirect", true)); // Redirect, same module

        moduleConfig.addForwardConfig(new ForwardConfig("contextForward",
                "/forward", false, // No redirect
                "/context")); // Specify module

        moduleConfig.addForwardConfig(new ForwardConfig("contextRedirect",
                "/redirect", true, // Redirect
                "/context")); // Specify module

        moduleConfig.addForwardConfig(new ForwardConfig("moduleNoslash",
                "module/noslash", false)); // No redirect, same module

        moduleConfig.addForwardConfig(new ForwardConfig("contextNoslash",
                "noslash", false, // No redirect
                "/context")); // Specify module
    }
View Full Code Here

        mapping.setPath("/noform");
        mapping.setType("org.apache.struts.mock.MockAction");
        moduleConfig2.addActionConfig(mapping);

        // Configure global forward declarations
        moduleConfig2.addForwardConfig(new ForwardConfig("moduleForward",
                "/module/forward", false)); // No redirect, same module

        moduleConfig2.addForwardConfig(new ForwardConfig("moduleRedirect",
                "/module/redirect", true)); // Redirect, same module

        moduleConfig2.addForwardConfig(new ForwardConfig("contextForward",
                "/forward", false, // No redirect
                "/context")); // Specify module

        moduleConfig2.addForwardConfig(new ForwardConfig("contextRedirect",
                "/redirect", true, // Redirect
                "/context")); // Specify module

        moduleConfig2.addForwardConfig(new ForwardConfig("moduleNoslash",
                "module/noslash", false)); // No redirect, same module

        moduleConfig2.addForwardConfig(new ForwardConfig("contextNoslash",
                "noslash", false, // No redirect
                "/context")); // Specify module
    }
View Full Code Here

        controller.setForwardPattern("/forwarding$M$P");
        controller.setInputForward(true);
        controller.setPagePattern("/paging$M$P");

        // Configure global forward declarations
        moduleConfig3.addForwardConfig(new ForwardConfig("moduleForward",
                "/module/forward", false)); // No redirect, same module

        moduleConfig3.addForwardConfig(new ForwardConfig("moduleRedirect",
                "/module/redirect", true)); // Redirect, same module

        moduleConfig3.addForwardConfig(new ForwardConfig("contextForward",
                "/forward", false, // No redirect
                "/context")); // Specify module

        moduleConfig3.addForwardConfig(new ForwardConfig("contextRedirect",
                "/redirect", true, // Redirect
                "/context")); // Specify module

        moduleConfig3.addForwardConfig(new ForwardConfig("moduleNoslash",
                "module/noslash", false)); // No redirect, same module

        moduleConfig3.addForwardConfig(new ForwardConfig("contextNoslash",
                "noslash", false, // No redirect
                "/context")); // specify module
    }
View Full Code Here

     * @param forwardName Logical name of the forwarding instance to be
     *                    returned
     * @return The local or global forward with the specified name.
     */
    public ActionForward findForward(String forwardName) {
        ForwardConfig config = findForwardConfig(forwardName);

        if (config == null) {
            config = getModuleConfig().findForwardConfig(forwardName);
        }

View Full Code Here

        }

        request.setAttribute(Globals.ERROR_KEY, errors);

        if (moduleConfig.getControllerConfig().getInputForward()) {
            ForwardConfig forward = mapping.findForward(input);

            processForwardConfig(request, response, forward);
        } else {
            internalModuleRelativeForward(input, request, response);
        }
View Full Code Here

        // Process forwards extensions.
        ForwardConfig[] forwards = config.findForwardConfigs();

        for (int i = 0; i < forwards.length; i++) {
            ForwardConfig forward = forwards[i];

            processForwardExtension(forward, config);
        }

        for (int i = 0; i < forwards.length; i++) {
            ForwardConfig forward = forwards[i];

            // Verify that required fields are all present for the forward
            if (forward.getPath() == null) {
                handleValueRequiredException("path", forward.getName(),
                    "global forward");
            }
        }
    }
View Full Code Here

            // Nothing to do, then
            return forwardConfig;
        }

        // Make sure that this config is of the right class
        ForwardConfig baseConfig = moduleConfig.findForwardConfig(ancestor);

        if (baseConfig == null) {
            throw new UnavailableException("Unable to find " + "forward '"
                + ancestor + "' to extend.");
        }

        // Was our forwards's class overridden already?
        if (forwardConfig.getClass().equals(ActionForward.class)) {
            // Ensure that our forward is using the correct class
            if (!baseConfig.getClass().equals(forwardConfig.getClass())) {
                // Replace the config with an instance of the correct class
                ForwardConfig newForwardConfig = null;
                String baseConfigClassName = baseConfig.getClass().getName();

                try {
                    newForwardConfig =
                        (ForwardConfig) RequestUtils.applicationInstance(baseConfigClassName);
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.