+ * See examples below for an example of how request parameters could be passed in. + *
+ * + * + * This result type takes the following parameters: + *
+ * + * + *
+ * + * + * Example: + * + *
+ * <package name="public" extends="struts-default"> + * <action name="login" class="..."> + * <!-- Redirect to another namespace --> + * <result type="redirectActionWithAnchor"> + * <param name="actionName">dashboard</param> + * <param name="namespace">/secure</param> + * <param name="anchorDest">lang_it/param> + * </result> + * </action> + * </package> + * + *+ * @see ActionMapper + */ +public class ServletActionRedirectResultXF extends ServletRedirectResult implements ReflectionExceptionHandler { + + private static final long serialVersionUID = 5004297536492031384L; + + /** The default parameter */ + public static final String DEFAULT_PARAM = "actionName"; + + private static final EntLogger LOG = EntLogFactory.getSanitizedLogger(ServletActionRedirectResultXF.class); + + /** + * -- SETTER -- + * Sets the action name + * @param actionName The name + */ + @Setter + protected String actionName; + /** + * -- SETTER -- + * Sets the namespace + * @param namespace The namespace + */ + @Setter + protected String namespace; + /** + * -- SETTER -- + * Sets the method + * @param method The method + */ + @Setter + protected String method; + @Setter + private String anchorDest; + + public ServletActionRedirectResultXF() { + super(); + } + + public ServletActionRedirectResultXF(String actionName) { + this(null, actionName, null, null); + } + + public ServletActionRedirectResultXF(String actionName, String method) { + this(null, actionName, method, null); + } + + + public ServletActionRedirectResultXF(String namespace, String actionName, String method) { + this(namespace, actionName, method, null); + } + + public ServletActionRedirectResultXF(String namespace, String actionName, String method, String anchor) { + super(null, anchor); + this.namespace = namespace; + this.actionName = actionName; + this.method = method; + } + + @Override + public void execute(ActionInvocation invocation) throws Exception { + this.actionName = this.conditionalParse(this.actionName, invocation); + if (this.namespace == null) { + this.namespace = invocation.getProxy().getNamespace(); + } else { + this.namespace = this.conditionalParse(this.namespace, invocation); + } + if (this.method == null) { + this.method = ""; + } else { + this.method = this.conditionalParse(this.method, invocation); + } + + HttpServletRequest request = ServletActionContext.getRequest(); + + String frontendScheme = UrlUtils.determineFrontendUrlObject(request).toURI().getScheme(); + String frontendServerName = UrlUtils.determineFrontendUrlObject(request).getHost(); + int frontendPort = UrlUtils.determineFrontendUrlObject(request).getPort(); + + String sbLocation = frontendScheme + "://" + + frontendServerName + ((frontendPort != -1) ? ":" + frontendPort : "") + + request.getContextPath() + + this.actionMapper.getUriFromActionMapping(new ActionMapping(actionName, namespace, method, null)); + + if (null != this.anchorDest) { + this.setAnchor(this.anchorDest); + } + +// System.out.println("\n" + +// "\n" + "|----------------------------------------------------------------------------------" + +// "\n" + "|- frontendScheme => " + frontendScheme + +// "\n" + "|- frontendServerName => " + frontendServerName + +// "\n" + "|- frontendPort => " + frontendPort + +// "\n" + "|- sbLocation => " + sbLocation + +// "\n" + "|----------------------------------------------------------------------------------" + +// "\n"); + + setLocation(sbLocation); + + super.execute(invocation); + } + + @Override + protected List