01: package org.vraptor.scope;
02:
03: import java.util.Set;
04:
05: import javax.servlet.ServletContext;
06:
07: /**
08: * The basic implementation of the application context.
09: *
10: * @author Guilherme Silveira
11: */
12: public class DefaultApplicationContext implements ApplicationContext {
13:
14: private ServletContext servletContex;
15:
16: public DefaultApplicationContext(ServletContext application) {
17: this .servletContex = application;
18: }
19:
20: public boolean hasAttribute(String name) {
21: return servletContex.getAttribute(name) != null;
22: }
23:
24: public void setAttribute(String name, Object value) {
25: servletContex.setAttribute(name, value);
26: }
27:
28: public Object getAttribute(String name) {
29: return servletContex.getAttribute(name);
30: }
31:
32: public Object removeAttribute(String name) {
33: Object value = servletContex.getAttribute(name);
34: servletContex.removeAttribute(name);
35: return value;
36: }
37:
38: public String getRealPath(String path) {
39: return servletContex.getRealPath(path);
40: }
41:
42: public Set getResourcePaths(String directory) {
43: return servletContex.getResourcePaths(directory);
44: }
45:
46: }
|