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 java.io.IOException;
23  import java.io.OutputStream;
24  
25  import javax.portlet.PortletURL;
26  import javax.portlet.RenderResponse;
27  
28  public class RenderResponseWrapper extends PortletResponseWrapper 
29  implements RenderResponse 
30  {
31     /***
32      * Creates a ServletResponse adaptor wrapping the given response object.
33      * @throws java.lang.IllegalArgumentException if the response is null.
34      */
35      public RenderResponseWrapper(RenderResponse renderResponse)
36      {
37          super(renderResponse);
38  
39          if (renderResponse == null) 
40          {
41              throw new IllegalArgumentException("Response cannot be null");
42          }
43      }
44  
45      // javax.portlet.RenderResponse implementation ------------------------------------------------
46      public String getContentType()
47      {
48          return this.getRenderResponse().getContentType();
49      }
50      
51      public PortletURL createRenderURL()
52      {
53          return this.getRenderResponse().createRenderURL();
54      }
55  
56      public PortletURL createActionURL()
57      {
58          return this.getRenderResponse().createActionURL();
59      }
60      
61      public String getNamespace()
62      {
63          return this.getRenderResponse().getNamespace();
64      }
65  
66      public void setTitle(String title)
67      {
68          this.getRenderResponse().setTitle(title);
69      }
70  
71      public void setContentType(String type)
72      {
73          this.getRenderResponse().setContentType(type);
74      }
75  
76      public String getCharacterEncoding()
77      {
78          return this.getRenderResponse().getCharacterEncoding();
79      }
80      
81      public java.io.PrintWriter getWriter() throws java.io.IOException
82      {
83          return this.getRenderResponse().getWriter();
84      }
85  
86      public java.util.Locale getLocale()
87      {
88          return this.getRenderResponse().getLocale();
89      }
90      
91      public void setBufferSize(int size)
92      {
93          this.getRenderResponse().setBufferSize(size);
94      }
95      
96      public int getBufferSize()
97      {
98          return this.getRenderResponse().getBufferSize();
99      }
100     
101     public void flushBuffer() throws java.io.IOException
102     {
103         this.getRenderResponse().flushBuffer();
104     }
105     
106     public void resetBuffer()
107     {
108         this.getRenderResponse().resetBuffer();
109     }
110     
111     public boolean isCommitted()
112     {
113         return this.getRenderResponse().isCommitted();
114     }
115     
116     public void reset()
117     {
118         this.getRenderResponse().reset();
119     }
120     
121     public OutputStream getPortletOutputStream() throws IOException 
122     {
123         return this.getRenderResponse().getPortletOutputStream();
124     }
125     // --------------------------------------------------------------------------------------------
126 
127     // additional methods -------------------------------------------------------------------------
128     /***
129      * Return the wrapped ServletResponse object.
130      */
131     public RenderResponse getRenderResponse()
132     {
133         return (RenderResponse) getPortletResponse();
134     }
135     // --------------------------------------------------------------------------------------------
136 
137 }
138