View Javadoc

1   /*
2    * Copyright 2003,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  /*
17   * This source code implements specifications defined by the Java
18   * Community Process. In order to remain compliant with the specification
19   * DO NOT add / change / or delete method signatures!
20   */
21  package javax.portlet;
22  
23  
24  /***
25   * The <CODE>ActionRequest</CODE> represents the request sent to the portlet
26   * to handle an action.
27   * It extends the PortletRequest interface to provide action request
28   * information to portlets.<br>
29   * The portlet container creates an <CODE>ActionRequest</CODE> object and
30   * passes it as argument to the portlet's <CODE>processAction</CODE> method.
31   * 
32   * @see PortletRequest
33   * @see RenderRequest
34   */
35  public interface ActionRequest extends PortletRequest
36  {
37  
38  
39  
40    /***
41     * Retrieves the body of the HTTP request from client to
42     * portal as binary data using
43     * an <CODE>InputStream</CODE>. Either this method or 
44     * {@link #getReader} may be called to read the body, but not both.
45     * <p>
46     * For HTTP POST data of type application/x-www-form-urlencoded
47     * this method throws an <code>IllegalStateException</code>
48     * as this data has been already processed by the 
49     * portal/portlet-container and is available as request parameters.
50     *
51     * @return an input stream containing the body of the request
52     *
53     * @exception java.lang.IllegalStateException
54     *                   if getReader was already called, or it is a 
55     *                   HTTP POST data of type application/x-www-form-urlencoded
56     * @exception java.io.IOException
57     *                   if an input or output exception occurred
58     */
59    public java.io.InputStream getPortletInputStream () throws java.io.IOException;
60  
61  
62  
63    /***
64     * Overrides the name of the character encoding used in the body of this
65     * request. This method must be called prior to reading input 
66     * using {@link #getReader} or {@link #getPortletInputStream}.
67     * <p>
68     * This method only sets the character set for the Reader that the
69     * {@link #getReader} method returns.
70     *
71     * @param	enc	a <code>String</code> containing the name of 
72     *			the chararacter encoding.
73     *
74     * @exception		java.io.UnsupportedEncodingException if this is not a valid encoding
75     * @exception		java.lang.IllegalStateException      if this method is called after 
76     *                                   reading request parameters or reading input using 
77     *                                   <code>getReader()</code>
78     */
79  
80    public void setCharacterEncoding(String enc) 
81      throws java.io.UnsupportedEncodingException;
82  
83  
84    /***
85     * Retrieves the body of the HTTP request from the client to the portal
86     * as character data using
87     * a <code>BufferedReader</code>.  The reader translates the character
88     * data according to the character encoding used on the body.
89     * Either this method or {@link #getPortletInputStream} may be called to read the
90     * body, not both.
91     * <p>
92     * For HTTP POST data of type application/x-www-form-urlencoded
93     * this method throws an <code>IllegalStateException</code>
94     * as this data has been already processed by the 
95     * portal/portlet-container and is available as request parameters.
96     *
97     * @return	a <code>BufferedReader</code>
98     *		containing the body of the request	
99     *
100    * @exception  java.io.UnsupportedEncodingException 	
101    *                 if the character set encoding used is 
102    * 		     not supported and the text cannot be decoded
103    * @exception  java.lang.IllegalStateException   	
104    *                 if {@link #getPortletInputStream} method
105    * 		     has been called on this request,  it is a 
106    *                   HTTP POST data of type application/x-www-form-urlencoded.
107    * @exception  java.io.IOException
108    *                 if an input or output exception occurred
109    *
110    * @see #getPortletInputStream
111    */
112   
113   public java.io.BufferedReader getReader()
114     throws java.io.UnsupportedEncodingException, java.io.IOException;
115     
116     
117   /***
118    * Returns the name of the character encoding used in the body of this request.
119    * This method returns <code>null</code> if the request
120    * does not specify a character encoding.
121    *
122    * @return		a <code>String</code> containing the name of 
123    *			the chararacter encoding, or <code>null</code>
124    *			if the request does not specify a character encoding.
125    */
126   
127   public java.lang.String getCharacterEncoding();
128 
129 
130 
131   /***
132    * Returns the MIME type of the body of the request, 
133    * or null if the type is not known.
134    *
135    * @return		a <code>String</code> containing the name 
136    *			of the MIME type of the request, or null 
137    *                    if the type is not known.
138    */
139 
140   public java.lang.String getContentType();
141 
142 
143   /***
144    * Returns the length, in bytes, of the request body 
145    * which is made available by the input stream, or -1 if the
146    * length is not known. 
147    *
148    *
149    * @return		an integer containing the length of the 
150    * 			request body or -1 if the length is not known
151    *
152    */
153 
154   public int getContentLength();
155     
156 
157     
158 
159 }