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