|
Struts example source code file (ActionChainResult.java)
The Struts ActionChainResult.java source code/* * Copyright 2002-2006,2009 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.opensymphony.xwork2; import com.opensymphony.xwork2.inject.Inject; import com.opensymphony.xwork2.util.TextParseUtil; import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.logging.Logger; import com.opensymphony.xwork2.util.logging.LoggerFactory; import java.util.*; /** * <!-- START SNIPPET: description --> * * This result invokes an entire other action, complete with it's own interceptor stack and result. * * <!-- END SNIPPET: description --> * * <b>This result type takes the following parameters: * * <!-- START SNIPPET: params --> * * <ul> * * <li>actionName (default) - the name of the action that will be chained to * * <li>namespace - used to determine which namespace the Action is in that we're chaining. If namespace is null, * this defaults to the current namespace</li> * * <li>method - used to specify another method on target action to be invoked. * If null, this defaults to execute method</li> * * <li>skipActions - (optional) the list of comma separated action names for the * actions that could be chained to</li> * * </ul> * * <!-- END SNIPPET: params --> * * <b>Example: * * <pre> * <package name="public" extends="struts-default"> * <!-- Chain creatAccount to login, using the default parameter --> * <action name="createAccount" class="..."> * <result type="chain">login</result> * </action> * * <action name="login" class="..."> * <!-- Chain to another namespace --> * <result type="chain"> * <param name="actionName">dashboard</param> * <param name="namespace">/secure</param> * </result> * </action> * </package> * * <package name="secure" extends="struts-default" namespace="/secure"> * <action name="dashboard" class="..."> * <result>dashboard.jsp</result> * </action> * </package> * <!-- END SNIPPET: example -->* * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu */ public class ActionChainResult implements Result { private static final Logger LOG = LoggerFactory.getLogger(ActionChainResult.class); /** * The result parameter name to set the name of the action to chain to. */ public static final String DEFAULT_PARAM = "actionName"; /** * The action context key to save the chain history. */ private static final String CHAIN_HISTORY = "CHAIN_HISTORY"; /** * The result parameter name to set the name of the action to chain to. */ public static final String SKIP_ACTIONS_PARAM = "skipActions"; private ActionProxy proxy; private String actionName; private String namespace; private String methodName; /** * The list of actions to skip. */ private String skipActions; private ActionProxyFactory actionProxyFactory; public ActionChainResult() { super(); } public ActionChainResult(String namespace, String actionName, String methodName) { this.namespace = namespace; this.actionName = actionName; this.methodName = methodName; } public ActionChainResult(String namespace, String actionName, String methodName, String skipActions) { this.namespace = namespace; this.actionName = actionName; this.methodName = methodName; this.skipActions = skipActions; } /** * @param actionProxyFactory the actionProxyFactory to set */ @Inject public void setActionProxyFactory(ActionProxyFactory actionProxyFactory) { this.actionProxyFactory = actionProxyFactory; } /** * Set the action name. * * @param actionName The action name. */ public void setActionName(String actionName) { this.actionName = actionName; } /** * sets the namespace of the Action that we're chaining to. if namespace * is null, this defaults to the current namespace. * * @param namespace the name of the namespace we're chaining to */ public void setNamespace(String namespace) { this.namespace = namespace; } /** * Set the list of actions to skip. * To test if an action should not throe an infinite recursion, * only the action name is used, not the namespace. * * @param actions The list of action name separated by a white space. */ public void setSkipActions(String actions) { this.skipActions = actions; } public void setMethod(String method) { this.methodName = method; } public ActionProxy getProxy() { return proxy; } /** * Get the XWork chain history. * The stack is a list of <code>namespace/action!method keys. */ public static LinkedList<String> getChainHistory() { LinkedList<String> chainHistory = (LinkedList Other Struts examples (source code examples)Here is a short list of links related to this Struts ActionChainResult.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.