1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.http.servlet;
12
13 import org.mule.api.MuleEvent;
14 import org.mule.api.MuleMessage;
15 import org.mule.transport.http.HttpConnector;
16 import org.mule.transport.http.HttpConstants;
17
18 import java.io.BufferedReader;
19 import java.io.IOException;
20 import java.io.UnsupportedEncodingException;
21 import java.security.Principal;
22 import java.util.Arrays;
23 import java.util.Enumeration;
24 import java.util.Iterator;
25 import java.util.Locale;
26 import java.util.Map;
27
28 import javax.servlet.RequestDispatcher;
29 import javax.servlet.ServletInputStream;
30 import javax.servlet.http.Cookie;
31 import javax.servlet.http.HttpServletRequest;
32 import javax.servlet.http.HttpSession;
33
34 import org.apache.commons.collections.iterators.IteratorEnumeration;
35
36
37
38
39 public class MuleHttpServletRequest implements HttpServletRequest
40 {
41 private MuleEvent event;
42 private MuleMessage message;
43
44 public MuleHttpServletRequest(MuleEvent event)
45 {
46 super();
47 this.event = event;
48 this.message = event.getMessage();
49 }
50
51 public Object getAttribute(String name)
52 {
53 return null;
54 }
55
56 public Enumeration getAttributeNames()
57 {
58 return null;
59 }
60
61 public String getCharacterEncoding()
62 {
63 return null;
64 }
65
66 public void setCharacterEncoding(String env) throws UnsupportedEncodingException
67 {
68 }
69
70 public int getContentLength()
71 {
72 return 0;
73 }
74
75 public String getContentType()
76 {
77 return message.getInboundProperty(HttpConstants.HEADER_CONTENT_TYPE);
78 }
79
80 public ServletInputStream getInputStream() throws IOException
81 {
82 return new ServletInputStream()
83 {
84
85 @Override
86 public int read() throws IOException
87 {
88 return 0;
89 }
90 };
91 }
92
93 public String getParameter(String name)
94 {
95 return null;
96 }
97
98 public Enumeration getParameterNames()
99 {
100 return null;
101 }
102
103 public String[] getParameterValues(String name)
104 {
105 return null;
106 }
107
108 public Map getParameterMap()
109 {
110 return null;
111 }
112
113 public String getProtocol()
114 {
115 return null;
116 }
117
118 public String getScheme()
119 {
120 return event.getMessageSourceURI().getScheme();
121 }
122
123 public String getServerName()
124 {
125 return null;
126 }
127
128 public int getServerPort()
129 {
130 return 0;
131 }
132
133 public BufferedReader getReader() throws IOException
134 {
135 return null;
136 }
137
138 public String getRemoteAddr()
139 {
140 return null;
141 }
142
143 public String getRemoteHost()
144 {
145 return null;
146 }
147
148 public void setAttribute(String name, Object o)
149 {
150 }
151
152 public void removeAttribute(String name)
153 {
154 }
155
156 public Locale getLocale()
157 {
158 return null;
159 }
160
161 public Enumeration getLocales()
162 {
163 return null;
164 }
165
166 public boolean isSecure()
167 {
168 return false;
169 }
170
171 public RequestDispatcher getRequestDispatcher(String path)
172 {
173 return null;
174 }
175
176 public String getRealPath(String path)
177 {
178 return null;
179 }
180
181 public int getRemotePort()
182 {
183 return 0;
184 }
185
186 public String getLocalName()
187 {
188 return null;
189 }
190
191 public String getLocalAddr()
192 {
193 return null;
194 }
195
196 public int getLocalPort()
197 {
198 return 0;
199 }
200
201 public String getAuthType()
202 {
203 return null;
204 }
205
206 public Cookie[] getCookies()
207 {
208 org.apache.commons.httpclient.Cookie[] cookies = message.getInboundProperty(HttpConnector.HTTP_COOKIES_PROPERTY);
209 if (cookies == null) return null;
210
211 Cookie[] servletCookies = new Cookie[cookies.length];
212 for (org.apache.commons.httpclient.Cookie c : cookies)
213 {
214 Cookie servletCookie = new Cookie(c.getName(), c.getValue());
215
216 servletCookie.setComment(c.getComment());
217 servletCookie.setDomain(c.getDomain());
218
219 }
220 return servletCookies;
221 }
222
223 public long getDateHeader(String name)
224 {
225 return 0;
226 }
227
228 public String getHeader(String name)
229 {
230 return message.getInboundProperty(name);
231 }
232
233 public Enumeration getHeaders(String name)
234 {
235 return new IteratorEnumeration(Arrays.asList(getHeader(name)).iterator());
236 }
237
238 public Enumeration getHeaderNames()
239 {
240 Iterator<String> iterator = message.getInboundPropertyNames().iterator();
241 return new IteratorEnumeration(iterator);
242 }
243
244 public int getIntHeader(String name)
245 {
246 return 0;
247 }
248
249 public String getMethod()
250 {
251 return null;
252 }
253
254 public String getPathInfo()
255 {
256 return null;
257 }
258
259 public String getPathTranslated()
260 {
261 return null;
262 }
263
264 public String getContextPath()
265 {
266 return null;
267 }
268
269 public String getQueryString()
270 {
271 return null;
272 }
273
274 public String getRemoteUser()
275 {
276 return null;
277 }
278
279 public boolean isUserInRole(String role)
280 {
281 return false;
282 }
283
284 public Principal getUserPrincipal()
285 {
286 return null;
287 }
288
289 public String getRequestedSessionId()
290 {
291 return null;
292 }
293
294 public String getRequestURI()
295 {
296 return null;
297 }
298
299 public StringBuffer getRequestURL()
300 {
301 return null;
302 }
303
304 public String getServletPath()
305 {
306 return null;
307 }
308
309 public HttpSession getSession(boolean create)
310 {
311 return null;
312 }
313
314 public HttpSession getSession()
315 {
316 return null;
317 }
318
319 public boolean isRequestedSessionIdValid()
320 {
321 return false;
322 }
323
324 public boolean isRequestedSessionIdFromCookie()
325 {
326 return false;
327 }
328
329 public boolean isRequestedSessionIdFromURL()
330 {
331 return false;
332 }
333
334 public boolean isRequestedSessionIdFromUrl()
335 {
336 return false;
337 }
338
339 }