View Javadoc

1   package org.apache.struts2.spi;
2   
3   import org.apache.struts2.Messages;
4   
5   import javax.servlet.ServletContext;
6   import javax.servlet.http.Cookie;
7   import javax.servlet.http.HttpServletRequest;
8   import javax.servlet.http.HttpServletResponse;
9   import java.util.List;
10  import java.util.Locale;
11  import java.util.Map;
12  
13  /***
14   * Request context. A single request may span multiple actions with action chaining.
15   *
16   * @author crazybob@google.com (Bob Lee)
17   */
18  public interface RequestContext {
19  
20      /***
21       * Gets context of the currently executing action.
22       *
23       * @return current action context
24       */
25      ActionContext getActionContext();
26  
27      /***
28       * Convenience method. Equivalent to {@code getActionContext().getAction()}.
29       *
30       * @return currently executing action
31       */
32      Object getAction();
33  
34      /***
35       * Gets map of request parameters.
36       */
37      Map<String, String[]> getParameterMap();
38  
39      /***
40       * Gets map of request attributes.
41       */
42      Map<String, Object> getAttributeMap();
43  
44      /***
45       * Gets map of session attributes.
46       */
47      Map<String, Object> getSessionMap();
48  
49      /***
50       * Gets map of application (servlet context) attributes.
51       */
52      Map<String, Object> getApplicationMap();
53  
54      /***
55       * Finds cookies with the given name,
56       */
57      List<Cookie> findCookiesForName(String name);
58  
59      /***
60       * Gets locale.
61       */
62      Locale getLocale();
63  
64      /***
65       * Sets locale. Stores the locale in the session for future requests.
66       */
67      void setLocale(Locale locale);
68  
69      /***
70       * Gets messages.
71       */
72      Messages getMessages();
73  
74      /***
75       * Gets the servlet request.
76       */
77      HttpServletRequest getServletRequest();
78  
79      /***
80       * Gets the servlet response.
81       */
82      HttpServletResponse getServletResponse();
83  
84      /***
85       * Gets the servlet context.
86       */
87      ServletContext getServletContext();
88  
89      /***
90       * Gets the value stack.
91       */
92      ValueStack getValueStack();
93  
94      /***
95       * Invokes the next interceptor or the action method if no more interceptors remain.
96       *
97       * @return result name
98       * @throws IllegalStateException if already invoked or called from the action
99       */
100     String proceed() throws Exception;
101 }