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: import javax.servlet.http.HttpServletRequest;
24:
25: /**
26: * {@link WebRequest} adapter for an {@link javax.servlet.http.HttpServletRequest}.
27: *
28: * @author Juergen Hoeller
29: * @since 2.0
30: */
31: public class ServletWebRequest extends ServletRequestAttributes
32: implements WebRequest {
33:
34: /**
35: * Create a new ServletWebRequest instance for the given request.
36: * @param request current HTTP request
37: */
38: public ServletWebRequest(HttpServletRequest request) {
39: super (request);
40: }
41:
42: public String getParameter(String paramName) {
43: return getRequest().getParameter(paramName);
44: }
45:
46: public String[] getParameterValues(String paramName) {
47: return getRequest().getParameterValues(paramName);
48: }
49:
50: public Map getParameterMap() {
51: return getRequest().getParameterMap();
52: }
53:
54: public Locale getLocale() {
55: return getRequest().getLocale();
56: }
57:
58: public String getContextPath() {
59: return getRequest().getContextPath();
60: }
61:
62: public String getRemoteUser() {
63: return getRequest().getRemoteUser();
64: }
65:
66: public Principal getUserPrincipal() {
67: return getRequest().getUserPrincipal();
68: }
69:
70: public boolean isUserInRole(String role) {
71: return getRequest().isUserInRole(role);
72: }
73:
74: public boolean isSecure() {
75: return getRequest().isSecure();
76: }
77:
78: }
|