KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > environment > portlet > ActionRequest


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
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 package org.apache.cocoon.environment.portlet;
17
18 import java.io.BufferedReader JavaDoc;
19 import java.io.IOException JavaDoc;
20 import java.io.InputStream JavaDoc;
21
22 /**
23  * Implements the {@link org.apache.cocoon.environment.Request} interface for the
24  * JSR-168 (Portlet) environment.
25  *
26  * @version CVS $Id: ActionRequest.java 123407 2004-12-27 13:51:59Z cziegeler $
27  * @author <a HREF="mailto:alex.rudnev@dc.gov">Alex Rudnev</a>
28  * @author <a HREF="mailto:vadim.gritsenko@dc.gov">Vadim Gritsenko</a>
29  */

30 public final class ActionRequest extends PortletRequest {
31
32     /**
33      * Creates a ActionRequest based on a real ActionRequest object
34      */

35     protected ActionRequest(String JavaDoc servletPath,
36                             String JavaDoc pathInfo,
37                             javax.portlet.ActionRequest request,
38                             PortletEnvironment environment) {
39         super(servletPath, pathInfo, request, environment);
40     }
41
42     // Request API methods
43

44     public String JavaDoc getCharacterEncoding() {
45         if (super.getCharacterEncoding() == null) {
46             return getActionRequest().getCharacterEncoding();
47         }
48         return super.getCharacterEncoding();
49     }
50
51     /**
52      * Action request can be always recognized by POST method
53      */

54     public String JavaDoc getMethod() {
55         return "POST";
56     }
57
58
59     // ActionRequest API methods
60

61     /**
62      * Type cast portletRequest to ActionRequest
63      *
64      * @return type casted portletRequest
65      */

66     public javax.portlet.ActionRequest getActionRequest() {
67         return (javax.portlet.ActionRequest) getPortletRequest();
68     }
69
70     public InputStream JavaDoc getInputStream() throws IOException JavaDoc {
71         return getActionRequest().getPortletInputStream();
72     }
73
74     public BufferedReader JavaDoc getReader() throws IOException JavaDoc {
75         return getActionRequest().getReader();
76     }
77
78     /**
79      * Action request provides content length for custom upload handling
80      */

81     public int getContentLength() {
82         return getActionRequest().getContentLength();
83     }
84
85     /**
86      * Action request provides content type for custom upload handling
87      */

88     public String JavaDoc getContentType() {
89         return getActionRequest().getContentType();
90     }
91 }
92
Popular Tags