View Javadoc
1   package org.andromda.cartridges.jsf.portlet.myfaces.tomahawk.support;
2   
3   import java.io.BufferedReader;
4   import java.io.IOException;
5   import java.io.UnsupportedEncodingException;
6   import java.security.Principal;
7   import java.util.Enumeration;
8   import java.util.Locale;
9   import java.util.Map;
10  import javax.portlet.PortalContext;
11  import javax.portlet.PortletContext;
12  import javax.portlet.PortletMode;
13  import javax.portlet.PortletPreferences;
14  import javax.portlet.PortletRequest;
15  import javax.portlet.PortletSession;
16  import javax.portlet.WindowState;
17  import javax.servlet.RequestDispatcher;
18  import javax.servlet.ServletInputStream;
19  import javax.servlet.http.Cookie;
20  import javax.servlet.http.HttpServletRequest;
21  import javax.servlet.http.HttpSession;
22  
23  /**
24   * This class is a dummy HttpServletRequest.
25   *
26   * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
27   * @author Chad Brandon
28   */
29  public class HttpServletRequestWrapper
30  implements HttpServletRequest
31  {
32      private final PortletRequest portletRequest;
33      private final PortletContext portletContext;
34  
35      /**
36       * @param portletRequest
37       * @param portletContext
38       */
39      public HttpServletRequestWrapper(
40          final PortletRequest portletRequest,
41          final PortletContext portletContext)
42      {
43          this.portletRequest = portletRequest;
44          this.portletContext = portletContext;
45      }
46  
47      /**
48       * @see javax.servlet.http.HttpServletRequest#getAuthType()
49       */
50      public String getAuthType()
51      {
52          return portletRequest.getAuthType();
53      }
54  
55      /**
56       * @see javax.servlet.http.HttpServletRequest#getContextPath()
57       */
58      public String getContextPath()
59      {
60          return portletRequest.getContextPath();
61      }
62  
63      /**
64       * @see javax.servlet.http.HttpServletRequest#getCookies()
65       */
66      public Cookie[] getCookies()
67      {
68          return new Cookie[0];
69      }
70  
71      /**
72       * @see javax.servlet.http.HttpServletRequest#getDateHeader(String)
73       */
74      public long getDateHeader(final String dateHeader)
75      {
76          return 0;
77      }
78  
79      /**
80       * @see javax.servlet.http.HttpServletRequest#getHeader(String)
81       */
82      public String getHeader(final String header)
83      {
84          return null;
85      }
86  
87      /**
88       * @see javax.servlet.http.HttpServletRequest#getHeaderNames()
89       */
90      public Enumeration getHeaderNames()
91      {
92          return null;
93      }
94  
95      /**
96       * @see javax.servlet.http.HttpServletRequest#getHeaders(String)
97       */
98      public Enumeration getHeaders(final String arg0)
99      {
100         return null;
101     }
102 
103     /**
104      * @see javax.servlet.http.HttpServletRequest#getIntHeader(String)
105      */
106     public int getIntHeader(final String arg0)
107     {
108         return 0;
109     }
110 
111     /**
112      * @see javax.servlet.http.HttpServletRequest#getMethod()
113      */
114     public String getMethod()
115     {
116         return null;
117     }
118 
119     /**
120      * @see javax.servlet.http.HttpServletRequest#getPathInfo()
121      */
122     public String getPathInfo()
123     {
124         return null;
125     }
126 
127     /**
128      * @see javax.servlet.http.HttpServletRequest#getPathTranslated()
129      */
130     public String getPathTranslated()
131     {
132         return null;
133     }
134 
135     /**
136      * @see javax.servlet.http.HttpServletRequest#getQueryString()
137      */
138     public String getQueryString()
139     {
140         return null;
141     }
142 
143     /**
144      * @see javax.servlet.http.HttpServletRequest#getRemoteUser()
145      */
146     public String getRemoteUser()
147     {
148         return portletRequest.getRemoteUser();
149     }
150 
151     /**
152      * @see javax.servlet.http.HttpServletRequest#getRequestedSessionId()
153      */
154     public String getRequestedSessionId()
155     {
156         return portletRequest.getRequestedSessionId();
157     }
158 
159     /**
160      * @see javax.servlet.http.HttpServletRequest#getRequestURI()
161      */
162     public String getRequestURI()
163     {
164         return null;
165     }
166 
167     /**
168      * @see javax.servlet.http.HttpServletRequest#getRequestURL()
169      */
170     public StringBuffer getRequestURL()
171     {
172         return null;
173     }
174 
175     /**
176      * @see javax.servlet.http.HttpServletRequest#getServletPath()
177      */
178     public String getServletPath()
179     {
180         return null;
181     }
182 
183     /**
184      * @see javax.servlet.http.HttpServletRequest#getSession()
185      */
186     public HttpSession getSession()
187     {
188         return new HttpSessionWrapper(portletRequest.getPortletSession(),
189             portletContext);
190     }
191 
192     /**
193      * @see javax.servlet.http.HttpServletRequest#getSession(boolean)
194      */
195     public HttpSession getSession(final boolean create)
196     {
197         return new HttpSessionWrapper(portletRequest.getPortletSession(create),
198             portletContext);
199     }
200 
201     /**
202      * @see javax.servlet.http.HttpServletRequest#getUserPrincipal()
203      */
204     public Principal getUserPrincipal()
205     {
206         return portletRequest.getUserPrincipal();
207     }
208 
209     /**
210      * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromCookie()
211      */
212     public boolean isRequestedSessionIdFromCookie()
213     {
214         return false;
215     }
216 
217     /**
218      * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromUrl()
219      * @deprecated
220      */
221     @Deprecated
222     public boolean isRequestedSessionIdFromUrl()
223     {
224         return false;
225     }
226 
227     /**
228      * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL()
229      */
230     public boolean isRequestedSessionIdFromURL()
231     {
232         return false;
233     }
234 
235     /**
236      * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdValid()
237      */
238     public boolean isRequestedSessionIdValid()
239     {
240         return portletRequest.isRequestedSessionIdValid();
241     }
242 
243     /**
244      * @see javax.servlet.http.HttpServletRequest#isUserInRole(String)
245      */
246     public boolean isUserInRole(final String arg0)
247     {
248         return portletRequest.isUserInRole(arg0);
249     }
250 
251     /**
252      * @see javax.servlet.ServletRequest#getAttribute(String)
253      */
254     public Object getAttribute(final String arg0)
255     {
256         return portletRequest.getAttribute(arg0);
257     }
258 
259     /**
260      * @see javax.servlet.ServletRequest#getAttributeNames()
261      */
262     public Enumeration getAttributeNames()
263     {
264         return portletRequest.getAttributeNames();
265     }
266 
267     /**
268      * @see javax.servlet.ServletRequest#getCharacterEncoding()
269      */
270     public String getCharacterEncoding()
271     {
272         return null;
273     }
274 
275     /**
276      * @see javax.servlet.ServletRequest#getContentLength()
277      */
278     public int getContentLength()
279     {
280         return 0;
281     }
282 
283     /**
284      * @see javax.servlet.ServletRequest#getContentType()
285      */
286     public String getContentType()
287     {
288         return null;
289     }
290 
291     /**
292      * @see javax.servlet.ServletRequest#getInputStream()
293      */
294     public ServletInputStream getInputStream() throws IOException
295     {
296         return null;
297     }
298 
299     /**
300      * @see javax.servlet.ServletRequest#getLocale()
301      */
302     public Locale getLocale()
303     {
304         return portletRequest.getLocale();
305     }
306 
307     /**
308      * @see javax.servlet.ServletRequest#getLocales()
309      */
310     public Enumeration getLocales()
311     {
312         return portletRequest.getLocales();
313     }
314 
315     /**
316      * @see javax.servlet.ServletRequest#getParameter(String)
317      */
318     public String getParameter(final String arg0)
319     {
320         return portletRequest.getParameter(arg0);
321     }
322 
323     /**
324      * @see javax.servlet.ServletRequest#getParameterMap()
325      */
326     public Map getParameterMap()
327     {
328         return portletRequest.getParameterMap();
329     }
330 
331     /**
332      * @see javax.servlet.ServletRequest#getParameterNames()
333      */
334     public Enumeration getParameterNames()
335     {
336         return portletRequest.getParameterNames();
337     }
338 
339     /**
340      * @see javax.servlet.ServletRequest#getParameterValues(String)
341      */
342     public String[] getParameterValues(final String arg0)
343     {
344         return portletRequest.getParameterValues(arg0);
345     }
346 
347     /**
348      * @see javax.servlet.ServletRequest#getProtocol()
349      */
350     public String getProtocol()
351     {
352         return null;
353     }
354 
355     /**
356      * @see javax.servlet.ServletRequest#getReader()
357      */
358     public BufferedReader getReader() throws IOException
359     {
360         return null;
361     }
362 
363     /**
364      * @see javax.servlet.ServletRequest#getRealPath(String)
365      * @deprecated
366      */
367     @Deprecated
368     public String getRealPath(final String arg0)
369     {
370         return null;
371     }
372 
373     /**
374      * @see javax.servlet.ServletRequest#getRemoteAddr()
375      */
376     public String getRemoteAddr()
377     {
378         return null;
379     }
380 
381     /**
382      * @see javax.servlet.ServletRequest#getRemoteHost()
383      */
384     public String getRemoteHost()
385     {
386         return null;
387     }
388 
389     /**
390      * @see javax.servlet.ServletRequest#getRequestDispatcher(String)
391      */
392     public RequestDispatcher getRequestDispatcher(final String arg0)
393     {
394         return null;
395     }
396 
397     /**
398      * @see javax.servlet.ServletRequest#getScheme()
399      */
400     public String getScheme()
401     {
402         return portletRequest.getScheme();
403     }
404 
405     /**
406      * @see javax.servlet.ServletRequest#getServerName()
407      */
408     public String getServerName()
409     {
410         return portletRequest.getServerName();
411     }
412 
413     /**
414      * @see javax.servlet.ServletRequest#getServerPort()
415      */
416     public int getServerPort()
417     {
418         return portletRequest.getServerPort();
419     }
420 
421     /**
422      * @see javax.servlet.ServletRequest#isSecure()
423      */
424     public boolean isSecure()
425     {
426         return portletRequest.isSecure();
427     }
428 
429     /**
430      * @see javax.servlet.ServletRequest#removeAttribute(String)
431      */
432     public void removeAttribute(final String arg0)
433     {
434         portletRequest.removeAttribute(arg0);
435     }
436 
437     /**
438      * @see javax.servlet.ServletRequest#setAttribute(String, Object)
439      */
440     public void setAttribute(final String arg0, final Object arg1)
441     {
442         portletRequest.setAttribute(arg0, arg1);
443     }
444 
445     /**
446      * @see javax.servlet.ServletRequest#setCharacterEncoding(String)
447      */
448     public void setCharacterEncoding(final String encoding) throws UnsupportedEncodingException
449     {
450     }
451 
452     /**
453      * @return portletRequest.getPortalContext()
454      */
455     public PortalContext getPortalContext()
456     {
457         return portletRequest.getPortalContext();
458     }
459 
460     /**
461      * @return portletRequest.getPortletMode()
462      */
463     public PortletMode getPortletMode()
464     {
465         return portletRequest.getPortletMode();
466     }
467 
468     /**
469      * @return portletRequest.getPortletSession()
470      */
471     public PortletSession getPortletSession()
472     {
473         return portletRequest.getPortletSession();
474     }
475 
476     /**
477      * @param create
478      * @return portletRequest.getPortletSession(create)
479      */
480     public PortletSession getPortletSession(final boolean create)
481     {
482         return portletRequest.getPortletSession(create);
483     }
484 
485     /**
486      * @return portletRequest.getPreferences()
487      */
488     public PortletPreferences getPreferences()
489     {
490         return portletRequest.getPreferences();
491     }
492 
493     /**
494      * @param arg0
495      * @return portletRequest.getProperties(arg0)
496      */
497     public Enumeration getProperties(final String arg0)
498     {
499         return portletRequest.getProperties(arg0);
500     }
501 
502     /**
503      * @param arg0
504      * @return portletRequest.getProperty(arg0)
505      */
506     public String getProperty(final String arg0)
507     {
508         return portletRequest.getProperty(arg0);
509     }
510 
511     /**
512      * @return portletRequest.getPropertyNames()
513      */
514     public Enumeration getPropertyNames()
515     {
516         return portletRequest.getPropertyNames();
517     }
518 
519     /**
520      * @return portletRequest.getResponseContentType()
521      */
522     public String getResponseContentType()
523     {
524         return portletRequest.getResponseContentType();
525     }
526 
527     /**
528      * @return portletRequest.getResponseContentTypes()
529      */
530     public Enumeration getResponseContentTypes()
531     {
532         return portletRequest.getResponseContentTypes();
533     }
534 
535     /**
536      * @return portletRequest.getWindowState()
537      */
538     public WindowState getWindowState()
539     {
540         return portletRequest.getWindowState();
541     }
542 
543     /**
544      * @param portletMode
545      * @return portletRequest.isPortletModeAllowed(portletMode)
546      */
547     public boolean isPortletModeAllowed(final PortletMode portletMode)
548     {
549         return portletRequest.isPortletModeAllowed(portletMode);
550     }
551 
552     /**
553      * @param windowState
554      * @return portletRequest.isWindowStateAllowed(windowState)
555      */
556     public boolean isWindowStateAllowed(final WindowState windowState)
557     {
558         return portletRequest.isWindowStateAllowed(windowState);
559     }
560 
561     /**
562      * @see javax.servlet.ServletRequest#getRemotePort()
563      */
564     public int getRemotePort()
565     {
566         return 0;
567     }
568 
569     /**
570      * @see javax.servlet.ServletRequest#getLocalName()
571      */
572     public String getLocalName()
573     {
574         return null;
575     }
576 
577     /**
578      * @see javax.servlet.ServletRequest#getLocalAddr()
579      */
580     public String getLocalAddr()
581     {
582         return null;
583     }
584 
585     /**
586      * @see javax.servlet.ServletRequest#getLocalPort()
587      */
588     public int getLocalPort()
589     {
590         return 0;
591     }
592 }