01: /*
02: * Copyright 2002-2006 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.servlet.handler;
18:
19: import java.util.Locale;
20:
21: import javax.servlet.http.HttpServletRequest;
22:
23: import org.springframework.web.context.request.ServletWebRequest;
24: import org.springframework.web.servlet.support.RequestContextUtils;
25:
26: /**
27: * ServletWebRequest that is aware of DispatcherServlet's request context,
28: * such as the Locale determined by a LocaleResolver.
29: *
30: * @author Juergen Hoeller
31: * @since 2.0
32: * @see #getLocale()
33: * @see org.springframework.web.servlet.LocaleResolver
34: */
35: public class DispatcherServletWebRequest extends ServletWebRequest {
36:
37: /**
38: * Create a new DispatcherServletWebRequest instance for the given request.
39: * @param request current HTTP request
40: */
41: public DispatcherServletWebRequest(HttpServletRequest request) {
42: super (request);
43: }
44:
45: public Locale getLocale() {
46: return RequestContextUtils.getLocale(getRequest());
47: }
48:
49: }
|