View Javadoc

1   /*
2    * Copyright 2003,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  /* 
17  
18   */
19  
20  package org.apache.pluto.portlet;
21  
22  import javax.portlet.ActionRequest;
23  
24  public class ActionRequestWrapper extends PortletRequestWrapper
25  implements ActionRequest 
26  {
27  
28     /***
29      * Creates a ServletRequest adaptor wrapping the given request object.
30      * @throws java.lang.IllegalArgumentException if the request is null.
31      */
32      public ActionRequestWrapper(ActionRequest actionRequest)
33      {
34          super(actionRequest);
35  
36          if (actionRequest == null) 
37          {
38              throw new IllegalArgumentException("Request cannot be null");
39          }
40      }
41  
42      // javax.portlet.ActionRequest implementation -------------------------------------------------    
43      public java.io.InputStream getPortletInputStream () throws java.io.IOException
44      {
45          return this.getActionRequest().getPortletInputStream();
46      }
47  
48      public void setCharacterEncoding(String enc) 
49        throws java.io.UnsupportedEncodingException
50      {
51          this.getActionRequest().setCharacterEncoding(enc);
52      }
53  
54      public java.io.BufferedReader getReader()
55        throws java.io.UnsupportedEncodingException, java.io.IOException
56      {
57          return this.getActionRequest().getReader();    
58      }
59      
60      public java.lang.String getCharacterEncoding()
61      {
62          return this.getActionRequest().getCharacterEncoding();
63      }
64  
65      public java.lang.String getContentType()
66      {
67          return this.getActionRequest().getContentType();
68      }
69  
70      public int getContentLength()
71      {
72          return this.getActionRequest().getContentLength();
73      }
74      
75      // --------------------------------------------------------------------------------------------
76      
77      // additional methods -------------------------------------------------------------------------
78      /***
79      * Return the wrapped ServletRequest object.
80      */
81      public ActionRequest getActionRequest()
82      {
83          return (ActionRequest) getPortletRequest();
84      }
85  
86      // --------------------------------------------------------------------------------------------
87  }
88