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