1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.pluto.portlet;
21
22 import javax.portlet.*;
23
24 public class PortletResponseWrapper extends javax.servlet.http.HttpServletResponseWrapper
25 implements PortletResponse
26 {
27
28 /***
29 * Creates a ServletResponse adaptor wrapping the given response object.
30 * @throws java.lang.IllegalArgumentException if the response is null.
31 */
32 public PortletResponseWrapper(PortletResponse portletResponse)
33 {
34 super((javax.servlet.http.HttpServletResponse)portletResponse);
35
36 if (portletResponse == null)
37 {
38 throw new IllegalArgumentException("Response cannot be null");
39 }
40 }
41
42
43 public void addProperty(String key, String value)
44 {
45 this.getPortletResponse().addProperty(key, value);
46 }
47
48 public void setProperty(String key, String value)
49 {
50 this.getPortletResponse().setProperty(key, value);
51 }
52
53 public String encodeURL(String path)
54 {
55 return this.getPortletResponse().encodeURL(path);
56 }
57
58
59
60 /***
61 * Return the wrapped ServletResponse object.
62 */
63 public PortletResponse getPortletResponse()
64 {
65 return (PortletResponse) super.getResponse();
66 }
67
68 /***
69 * Sets the response being wrapped.
70 * @throws java.lang.IllegalArgumentException if the response is null.
71 */
72 public void setResponse(PortletResponse response)
73 {
74 if (response == null)
75 {
76 throw new IllegalArgumentException("Response cannot be null");
77 }
78 setResponse((javax.servlet.http.HttpServletResponse)response);
79 }
80
81 }
82