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