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: /**
20: * Request-backed {@link org.springframework.beans.factory.config.Scope}
21: * implementation.
22: *
23: * <p>Relies on a thread-bound {@link RequestAttributes} instance, which
24: * can be exported through {@link RequestContextListener},
25: * {@link org.springframework.web.filter.RequestContextFilter} or
26: * {@link org.springframework.web.servlet.DispatcherServlet}.
27: *
28: * <p>This <code>Scope</code> will also work for Portlet environments,
29: * through an alternate <code>RequestAttributes</code> implementation
30: * (as exposed out-of-the-box by Spring's
31: * {@link org.springframework.web.portlet.DispatcherPortlet}.
32: *
33: * @author Rod Johnson
34: * @author Juergen Hoeller
35: * @author Rob Harrop
36: * @since 2.0
37: * @see RequestContextHolder#currentRequestAttributes()
38: * @see RequestAttributes#SCOPE_REQUEST
39: * @see RequestContextListener
40: * @see org.springframework.web.filter.RequestContextFilter
41: * @see org.springframework.web.servlet.DispatcherServlet
42: * @see org.springframework.web.portlet.DispatcherPortlet
43: */
44: public class RequestScope extends AbstractRequestAttributesScope {
45:
46: protected int getScope() {
47: return RequestAttributes.SCOPE_REQUEST;
48: }
49:
50: /**
51: * There is no conversation id concept for a request, so this method
52: * returns <code>null</code>.
53: */
54: public String getConversationId() {
55: return null;
56: }
57:
58: }
|