01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.springframework.web.portlet.util;
18:
19: import java.io.BufferedReader;
20: import java.io.IOException;
21: import java.io.InputStream;
22: import java.io.UnsupportedEncodingException;
23:
24: import javax.portlet.ActionRequest;
25:
26: /**
27: * Simple wrapper for a Portlet {@link javax.portlet.ActionRequest},
28: * delegating all calls to the underlying request.
29: *
30: * <p>(In the style of the Servlet API's {@link javax.servlet.http.HttpServletRequestWrapper}.)
31: *
32: * @author Juergen Hoeller
33: * @since 2.0
34: * @see ActionRequestWrapper
35: * @see javax.servlet.http.HttpServletRequestWrapper
36: */
37: public class ActionRequestWrapper extends PortletRequestWrapper
38: implements ActionRequest {
39:
40: /** Original request that we're delegating to */
41: private final ActionRequest actionRequest;
42:
43: /**
44: * Create a ActionRequestWrapper for the given request.
45: * @param request the original request to wrap
46: * @throws IllegalArgumentException if the supplied <code>request</code> is <code>null</code>
47: */
48: public ActionRequestWrapper(ActionRequest request) {
49: super (request);
50: this .actionRequest = request;
51: }
52:
53: public InputStream getPortletInputStream() throws IOException {
54: return this .actionRequest.getPortletInputStream();
55: }
56:
57: public void setCharacterEncoding(String enc)
58: throws UnsupportedEncodingException {
59: this .actionRequest.setCharacterEncoding(enc);
60: }
61:
62: public BufferedReader getReader() throws IOException {
63: return this .actionRequest.getReader();
64: }
65:
66: public String getCharacterEncoding() {
67: return this .actionRequest.getCharacterEncoding();
68: }
69:
70: public String getContentType() {
71: return this .actionRequest.getContentType();
72: }
73:
74: public int getContentLength() {
75: return this.actionRequest.getContentLength();
76: }
77:
78: }
|