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 javax.portlet.PortletResponse;
20:
21: public class PortletResponseWrapper extends
22: javax.servlet.http.HttpServletResponseWrapper implements
23: PortletResponse {
24:
25: /**
26: * Creates a ServletResponse adaptor wrapping the given response object.
27: * @throws java.lang.IllegalArgumentException
28: * if the response is null.
29: */
30: public PortletResponseWrapper(PortletResponse portletResponse) {
31: super ((javax.servlet.http.HttpServletResponse) portletResponse);
32:
33: if (portletResponse == null) {
34: throw new IllegalArgumentException(
35: "Response cannot be null");
36: }
37: }
38:
39: // javax.portlet.PortletResponse implementation ------------------------------------------------
40: public void addProperty(String key, String value) {
41: this .getPortletResponse().addProperty(key, value);
42: }
43:
44: public void setProperty(String key, String value) {
45: this .getPortletResponse().setProperty(key, value);
46: }
47:
48: public String encodeURL(String path) {
49: return this .getPortletResponse().encodeURL(path);
50: }
51:
52: // --------------------------------------------------------------------------------------------
53:
54: // additional methods -------------------------------------------------------------------------
55: /**
56: * Return the wrapped ServletResponse object.
57: */
58: public PortletResponse getPortletResponse() {
59: return (PortletResponse) super .getResponse();
60: }
61:
62: /**
63: * Sets the response being wrapped.
64: * @throws java.lang.IllegalArgumentException
65: * if the response is null.
66: */
67: public void setResponse(PortletResponse response) {
68: if (response == null) {
69: throw new IllegalArgumentException(
70: "Response cannot be null");
71: }
72: setResponse((javax.servlet.http.HttpServletResponse) response);
73: }
74: // --------------------------------------------------------------------------------------------
75: }
|