01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.pluto.wrappers;
18:
19: import java.util.Map;
20:
21: import javax.portlet.ActionResponse;
22: import javax.portlet.PortletMode;
23: import javax.portlet.PortletModeException;
24: import javax.portlet.WindowState;
25: import javax.portlet.WindowStateException;
26:
27: public class ActionResponseWrapper extends PortletResponseWrapper
28: implements ActionResponse {
29:
30: /**
31: * Creates a ServletResponse adaptor wrapping the given response object.
32: * @throws java.lang.IllegalArgumentException
33: * if the response is null.
34: */
35: public ActionResponseWrapper(ActionResponse actionResponse) {
36: super (actionResponse);
37:
38: if (actionResponse == null) {
39: throw new IllegalArgumentException(
40: "Response cannot be null");
41: }
42: }
43:
44: // javax.portlet.ActionResponse implementation ------------------------------------------------
45: public void setWindowState(WindowState windowState)
46: throws WindowStateException {
47: this .getActionResponse().setWindowState(windowState);
48: }
49:
50: public void setPortletMode(PortletMode portletMode)
51: throws PortletModeException {
52: this .getActionResponse().setPortletMode(portletMode);
53: }
54:
55: public void sendRedirect(String location)
56: throws java.io.IOException {
57: this .getActionResponse().sendRedirect(location);
58: }
59:
60: public void setRenderParameters(Map parameters) {
61: this .getActionResponse().setRenderParameters(parameters);
62: }
63:
64: public void setRenderParameter(String key, String value) {
65: this .getActionResponse().setRenderParameter(key, value);
66: }
67:
68: public void setRenderParameter(String key, String[] values) {
69: this .getActionResponse().setRenderParameter(key, values);
70: }
71:
72: // --------------------------------------------------------------------------------------------
73:
74: // additional methods -------------------------------------------------------------------------
75: /**
76: * Return the wrapped ServletResponse object.
77: */
78: public ActionResponse getActionResponse() {
79: return (ActionResponse) getPortletResponse();
80: }
81:
82: // --------------------------------------------------------------------------------------------
83: }
|