1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.tiles.context;
22
23 import java.io.IOException;
24 import java.util.Locale;
25 import java.util.Map;
26
27 /***
28 * Encapsulation of request information.
29 *
30 * @since 2.0
31 * @version $Rev: 527536 $ $Date: 2007-04-11 17:44:51 +0200 (Wed, 11 Apr 2007) $
32 */
33 public interface TilesRequestContext {
34
35 /***
36 * Return an immutable Map that maps header names to the first (or only)
37 * header value (as a String).
38 *
39 * @return The header map.
40 */
41 Map<String, String> getHeader();
42
43 /***
44 * Return an immutable Map that maps header names to the set of all values
45 * specified in the request (as a String array). Header names must be
46 * matched in a case-insensitive manner.
47 *
48 * @return The header values map.
49 */
50 Map<String, String[]> getHeaderValues();
51
52 /***
53 * Return a mutable Map that maps request scope attribute names to their
54 * values.
55 *
56 * @return The request scope map.
57 */
58 Map<String, Object> getRequestScope();
59
60 /***
61 * Return a mutable Map that maps session scope attribute names to their
62 * values.
63 *
64 * @return The request scope map.
65 */
66 Map<String, Object> getSessionScope();
67
68 /***
69 * Dispatches the request to a specified path.
70 *
71 * @param path The path to dispatch to.
72 * @throws IOException If something goes wrong during dispatching.
73 */
74 void dispatch(String path) throws IOException;
75
76 /***
77 * Includes the response from the specified URL in the current response output.
78 *
79 * @param path The path to include.
80 * @throws IOException If something goes wrong during inclusion.
81 */
82 void include(String path) throws IOException;
83
84 /***
85 * Return an immutable Map that maps request parameter names to the first
86 * (or only) value (as a String).
87 *
88 * @return The parameter map.
89 */
90 Map<String, String> getParam();
91
92 /***
93 * Return an immutable Map that maps request parameter names to the set of
94 * all values (as a String array).
95 *
96 * @return The parameter values map.
97 */
98 Map<String, String[]> getParamValues();
99
100 /***
101 * Return the preferred Locale in which the client will accept content.
102 *
103 * @return The current request locale. It is the locale of the request
104 * object itself and it is NOT the locale that the user wants to use. See
105 * {@link org.apache.tiles.locale.LocaleResolver} to implement strategies to
106 * resolve locales.
107 */
108 Locale getRequestLocale();
109
110 /***
111 * Determine whether or not the specified user is in the given role.
112 * @param role the role to check against.
113 * @return <code>true</code> if the user is in the given role.
114 */
115 boolean isUserInRole(String role);
116
117 /***
118 * Get the underlying request.
119 *
120 * @return The current request object.
121 */
122 Object getRequest();
123
124 /***
125 * Get the underlying response.
126 *
127 * @return The current request object.
128 */
129 Object getResponse();
130 }