1 package org.apache.struts2.spi; 2 3 import java.lang.reflect.Method; 4 5 /*** 6 * Context of an action execution. 7 * 8 * @author crazybob@google.com (Bob Lee) 9 */ 10 public interface ActionContext { 11 12 /*** 13 * Gets action instance. 14 */ 15 Object getAction(); 16 17 /*** 18 * Gets action method. 19 */ 20 Method getMethod(); 21 22 /*** 23 * Gets action name. 24 */ 25 String getActionName(); 26 27 /*** 28 * Gets the path for the action's namespace. 29 */ 30 String getNamespacePath(); 31 32 /*** 33 * Gets the {@link Result} instance for the action. 34 * 35 * @return {@link Result} instance or {@code null} if we don't have a result yet. 36 */ 37 Result getResult(); 38 39 /*** 40 * Adds a result interceptor for the action. Enables executing code before and after a result, executing an 41 * alternate result, etc. 42 */ 43 void addResultInterceptor(Result interceptor); 44 45 /*** 46 * Gets context of action which chained to us. 47 * 48 * @return context of previous action or {@code null} if this is the first action in the chain 49 */ 50 ActionContext getPrevious(); 51 52 /*** 53 * Gets context of action which this action chained to. 54 * 55 * @return context of next action or {@code null} if we haven't chained to another action yet or this is the last 56 * action in the chain. 57 */ 58 ActionContext getNext(); 59 }