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