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.util.Map;
23  
24  import javax.portlet.*;
25  
26  public class ActionResponseWrapper extends PortletResponseWrapper 
27  implements ActionResponse 
28  {
29  
30      /***
31      * Creates a ServletResponse adaptor wrapping the given response object.
32      * @throws java.lang.IllegalArgumentException if the response is null.
33      */
34      public ActionResponseWrapper(ActionResponse actionResponse)
35      {
36          super(actionResponse);
37  
38          if (actionResponse == null) 
39          {
40              throw new IllegalArgumentException("Response cannot be null");
41          }
42      }
43  
44      // javax.portlet.ActionResponse implementation ------------------------------------------------
45      public void setWindowState(WindowState windowState) throws WindowStateException
46      {
47          this.getActionResponse().setWindowState(windowState);
48      }
49  
50      public void setPortletMode(PortletMode portletMode) throws PortletModeException
51      {
52          this.getActionResponse().setPortletMode(portletMode); 
53      }
54  
55      public void sendRedirect(String location) throws java.io.IOException
56      { 
57          this.getActionResponse().sendRedirect(location);
58      }
59  
60      public void setRenderParameters(Map parameters)
61      {
62          this.getActionResponse().setRenderParameters(parameters);
63      }
64  
65      public void setRenderParameter(String key, String value)
66      {
67          this.getActionResponse().setRenderParameter(key, value);
68      }
69  
70      public void setRenderParameter(String key, String[] values)
71      {
72          this.getActionResponse().setRenderParameter(key, values);
73      }
74  
75      // --------------------------------------------------------------------------------------------
76  
77      // additional methods -------------------------------------------------------------------------
78      /***
79       * Return the wrapped ServletResponse object.
80       */
81      public ActionResponse getActionResponse()
82      {
83          return (ActionResponse) getPortletResponse();
84      }
85  
86      // --------------------------------------------------------------------------------------------
87  }
88