01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.web.context.request;
18:
19: import java.security.Principal;
20: import java.util.Locale;
21: import java.util.Map;
22:
23: /**
24: * Generic interface for a web request. Mainly intended for generic web
25: * request interceptors, giving them access to general request metadata,
26: * not for actual handling of the request.
27: *
28: * @author Juergen Hoeller
29: * @since 2.0
30: * @see WebRequestInterceptor
31: */
32: public interface WebRequest extends RequestAttributes {
33:
34: /**
35: * Return the request parameter of the given name, or <code>null</code> if none.
36: * <p>Retrieves the first parameter value in case of a multi-value parameter.
37: * @see javax.servlet.http.HttpServletRequest#getParameter(String)
38: */
39: String getParameter(String paramName);
40:
41: /**
42: * Return the request parameter values for the given parameter name,
43: * or <code>null</code> if none.
44: * <p>A single-value parameter will be exposed as an array with a single element.
45: * @see javax.servlet.http.HttpServletRequest#getParameterValues(String)
46: */
47: String[] getParameterValues(String paramName);
48:
49: /**
50: * Return a immutable Map of the request parameters, with parameter names as map keys
51: * and parameter values as map values. The map values will be of type String array.
52: * <p>A single-value parameter will be exposed as an array with a single element.
53: * @see javax.servlet.http.HttpServletRequest#getParameterMap()
54: */
55: Map getParameterMap();
56:
57: /**
58: * Return the primary Locale for this request.
59: * @see javax.servlet.http.HttpServletRequest#getLocale()
60: */
61: Locale getLocale();
62:
63: /**
64: * Return the context path for this request
65: * (usually the base path that the current web application is mapped to).
66: * @see javax.servlet.http.HttpServletRequest#getContextPath()
67: */
68: String getContextPath();
69:
70: /**
71: * Return the remote user for this request, if any.
72: * @see javax.servlet.http.HttpServletRequest#getRemoteUser()
73: */
74: String getRemoteUser();
75:
76: /**
77: * Return the user principal for this request, if any.
78: * @see javax.servlet.http.HttpServletRequest#getUserPrincipal()
79: */
80: Principal getUserPrincipal();
81:
82: /**
83: * Determine whether the user is in the given role for this request.
84: * @see javax.servlet.http.HttpServletRequest#isUserInRole(String)
85: */
86: boolean isUserInRole(String role);
87:
88: /**
89: * Return whether this request has been sent over a secure transport
90: * mechanism (such as SSL).
91: * @see javax.servlet.http.HttpServletRequest#isSecure()
92: */
93: boolean isSecure();
94:
95: }
|