View Javadoc

1   /*
2    * $Id: ActionContext.java 502296 2007-02-01 17:33:39Z niallp $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts2.spi;
22  
23  import java.lang.reflect.Method;
24  
25  /***
26   * Context of an action execution.
27   *
28   * @author crazybob@google.com (Bob Lee)
29   */
30  public interface ActionContext {
31  
32      /***
33       * Gets action instance.
34       */
35      Object getAction();
36  
37      /***
38       * Gets action method.
39       */
40      Method getMethod();
41  
42      /***
43       * Gets action name.
44       */
45      String getActionName();
46  
47      /***
48       * Gets the path for the action's namespace.
49       */
50      String getNamespacePath();
51  
52      /***
53       * Gets the {@link Result} instance for the action.
54       *
55       * @return {@link Result} instance or {@code null} if we don't have a result yet.
56       */
57      Result getResult();
58  
59      /***
60       * Adds a result interceptor for the action. Enables executing code before and after a result, executing an
61       * alternate result, etc.
62       */
63      void addResultInterceptor(Result interceptor);
64  
65      /***
66       * Gets context of action which chained to us.
67       *
68       * @return context of previous action or {@code null} if this is the first action in the chain
69       */
70      ActionContext getPrevious();
71  
72      /***
73       * Gets context of action which this action chained to.
74       *
75       * @return context of next action or {@code null} if we haven't chained to another action yet or this is the last
76       *  action in the chain.
77       */
78      ActionContext getNext();
79  }