KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > portlet > util > ActionRequestWrapper


1 /*
2  * Copyright 2002-2006 the original author or authors.
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 package org.springframework.web.portlet.util;
18
19 import java.io.BufferedReader JavaDoc;
20 import java.io.IOException JavaDoc;
21 import java.io.InputStream JavaDoc;
22 import java.io.UnsupportedEncodingException JavaDoc;
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 implements ActionRequest {
38
39     /** Original request that we're delegating to */
40     private final ActionRequest actionRequest;
41
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
54     public InputStream JavaDoc getPortletInputStream() throws IOException JavaDoc {
55         return this.actionRequest.getPortletInputStream();
56     }
57
58     public void setCharacterEncoding(String JavaDoc enc) throws UnsupportedEncodingException JavaDoc {
59         this.actionRequest.setCharacterEncoding(enc);
60     }
61
62     public BufferedReader JavaDoc getReader() throws IOException JavaDoc {
63         return this.actionRequest.getReader();
64     }
65
66     public String JavaDoc getCharacterEncoding() {
67         return this.actionRequest.getCharacterEncoding();
68     }
69
70     public String JavaDoc getContentType() {
71         return this.actionRequest.getContentType();
72     }
73
74     public int getContentLength() {
75         return this.actionRequest.getContentLength();
76     }
77
78 }
79
Popular Tags