1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.portals.bridges.struts;
18
19 import java.io.InputStream;
20 import java.net.MalformedURLException;
21 import java.net.URL;
22 import java.util.Enumeration;
23 import java.util.Set;
24
25 import javax.servlet.RequestDispatcher;
26 import javax.servlet.Servlet;
27 import javax.servlet.ServletContext;
28 import javax.servlet.ServletException;
29
30
31 /***
32 * PortletServletContextImpl
33 *
34 * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
35 * @version $Id: PortletServletContextImpl.java 517068 2007-03-12 01:44:37Z ate $
36 */
37 public class PortletServletContextImpl implements ServletContext
38 {
39 private ServletContext context;
40 public PortletServletContextImpl(ServletContext context)
41 {
42 this.context = context;
43 }
44 public Object getAttribute(String arg0)
45 {
46 return context.getAttribute(arg0);
47 }
48 public Enumeration getAttributeNames()
49 {
50 return context.getAttributeNames();
51 }
52 public ServletContext getContext(String arg0)
53 {
54 ServletContext refContext = context.getContext(arg0);
55 if (refContext == context)
56 return this;
57 else
58 return refContext;
59 }
60 public String getInitParameter(String arg0)
61 {
62 return context.getInitParameter(arg0);
63 }
64 public Enumeration getInitParameterNames()
65 {
66 return context.getInitParameterNames();
67 }
68 public int getMajorVersion()
69 {
70 return context.getMajorVersion();
71 }
72 public String getMimeType(String arg0)
73 {
74 return context.getMimeType(arg0);
75 }
76 public int getMinorVersion()
77 {
78 return context.getMinorVersion();
79 }
80 public RequestDispatcher getNamedDispatcher(String arg0)
81 {
82 RequestDispatcher dispatcher = context.getNamedDispatcher(arg0);
83 if (dispatcher != null)
84 dispatcher = new PortletServletRequestDispatcher(dispatcher, arg0,
85 true);
86 return dispatcher;
87 }
88 public String getRealPath(String arg0)
89 {
90 return context.getRealPath(arg0);
91 }
92 public RequestDispatcher getRequestDispatcher(String arg0)
93 {
94 RequestDispatcher dispatcher = context.getRequestDispatcher(arg0);
95 if (dispatcher != null)
96 dispatcher = new PortletServletRequestDispatcher(dispatcher, arg0,
97 false);
98 return dispatcher;
99 }
100 public URL getResource(String arg0) throws MalformedURLException
101 {
102 return context.getResource(arg0);
103 }
104 public InputStream getResourceAsStream(String arg0)
105 {
106 return context.getResourceAsStream(arg0);
107 }
108 public Set getResourcePaths(String arg0)
109 {
110 return context.getResourcePaths(arg0);
111 }
112 public String getServerInfo()
113 {
114 return context.getServerInfo();
115 }
116
117 /***
118 * @deprecated Deprecated. As of Java Servlet API 2.1,
119 * with no direct replacement.
120 */
121 public Servlet getServlet(String arg0) throws ServletException
122 {
123 return context.getServlet(arg0);
124 }
125 public String getServletContextName()
126 {
127 return context.getServletContextName();
128 }
129
130 /***
131 * @deprecated As of Java Servlet API 2.0,
132 * with no replacement.
133 */
134 public Enumeration getServletNames()
135 {
136 return context.getServletNames();
137 }
138
139 /***
140 * @deprecated As of Java Servlet API 2.0,
141 * with no replacement.
142 */
143 public Enumeration getServlets()
144 {
145 return context.getServlets();
146 }
147
148 /***
149 * @deprecated As of Java Servlet API 2.1, use
150 * log(String message, Throwable throwable) instead.
151 */
152 public void log(Exception arg0, String arg1)
153 {
154 context.log(arg0, arg1);
155 }
156 public void log(String arg0)
157 {
158 context.log(arg0);
159 }
160 public void log(String arg0, Throwable arg1)
161 {
162 context.log(arg0, arg1);
163 }
164 public void removeAttribute(String arg0)
165 {
166 context.removeAttribute(arg0);
167 }
168 public void setAttribute(String arg0, Object arg1)
169 {
170 context.setAttribute(arg0, arg1);
171 }
172 public String toString()
173 {
174 return context.toString();
175 }
176 }