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.context;
18:
19: import javax.servlet.ServletContext;
20:
21: import org.springframework.context.ApplicationContext;
22:
23: /**
24: * Interface to provide configuration for a web application. This is read-only while
25: * the application is running, but may be reloaded if the implementation supports this.
26: *
27: * <p>This interface adds a getServletContext method to the generic ApplicationContext
28: * interface, and defines a well-known application attribute name that the root
29: * context must be bound to in the bootstrap process.
30: *
31: * <p>Like generic application contexts, web application contexts are hierarchical.
32: * There is a single root context per application, while each servlet in the application
33: * (including a dispatcher servlet in the MVC framework) has its own child context.
34: *
35: * <p>In addition to standard application context lifecycle capabilities,
36: * WebApplicationContext implementations need to detect ServletContextAware
37: * beans and invoke the setServletContext method accordingly.
38: *
39: * @author Rod Johnson
40: * @author Juergen Hoeller
41: * @since January 19, 2001
42: * @see ServletContextAware#setServletContext
43: */
44: public interface WebApplicationContext extends ApplicationContext {
45:
46: /**
47: * Context attribute to bind root WebApplicationContext to on successful startup.
48: * <p>Note: If the startup of the root context fails, this attribute can contain
49: * an exception or error as value. Use WebApplicationContextUtils for convenient
50: * lookup of the root WebApplicationContext.
51: * @see org.springframework.web.context.support.WebApplicationContextUtils#getWebApplicationContext
52: * @see org.springframework.web.context.support.WebApplicationContextUtils#getRequiredWebApplicationContext
53: */
54: String ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE = WebApplicationContext.class
55: .getName()
56: + ".ROOT";
57:
58: /**
59: * Scope identifier for request scope: "request".
60: * Supported in addition to the standard scopes "singleton" and "prototype".
61: */
62: String SCOPE_REQUEST = "request";
63:
64: /**
65: * Scope identifier for session scope: "session".
66: * Supported in addition to the standard scopes "singleton" and "prototype".
67: */
68: String SCOPE_SESSION = "session";
69:
70: /**
71: * Scope identifier for global session scope: "globalSession".
72: * Supported in addition to the standard scopes "singleton" and "prototype".
73: */
74: String SCOPE_GLOBAL_SESSION = "globalSession";
75:
76: /**
77: * Return the standard Servlet API ServletContext for this application.
78: */
79: ServletContext getServletContext();
80:
81: }
|