KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > portlet > ActionRequest


1 /**
2   * Copyright 2003 IBM Corporation and Sun Microsystems, Inc.
3   * All rights reserved.
4   * Use is subject to license terms.
5   */

6
7 package javax.portlet;
8
9
10 /**
11  * The <CODE>ActionRequest</CODE> represents the request sent to the portlet
12  * to handle an action.
13  * It extends the PortletRequest interface to provide action request
14  * information to portlets.<br>
15  * The portlet container creates an <CODE>ActionRequest</CODE> object and
16  * passes it as argument to the portlet's <CODE>processAction</CODE> method.
17  *
18  * @see PortletRequest
19  * @see RenderRequest
20  */

21 public interface ActionRequest extends PortletRequest
22 {
23
24
25   /**
26    * Retrieves the body of the HTTP request from client to
27    * portal as binary data using
28    * an <CODE>InputStream</CODE>. Either this method or
29    * {@link #getReader} may be called to read the body, but not both.
30    * <p>
31    * For HTTP POST data of type application/x-www-form-urlencoded
32    * this method throws an <code>IllegalStateException</code>
33    * as this data has been already processed by the
34    * portal/portlet-container and is available as request parameters.
35    *
36    * @return an input stream containing the body of the request
37    *
38    * @exception java.lang.IllegalStateException
39    * if getReader was already called, or it is a
40    * HTTP POST data of type application/x-www-form-urlencoded
41    * @exception java.io.IOException
42    * if an input or output exception occurred
43    */

44   public java.io.InputStream JavaDoc getPortletInputStream () throws java.io.IOException JavaDoc;
45
46
47
48   /**
49    * Overrides the name of the character encoding used in the body of this
50    * request. This method must be called prior to reading input
51    * using {@link #getReader} or {@link #getPortletInputStream}.
52    * <p>
53    * This method only sets the character set for the Reader that the
54    * {@link #getReader} method returns.
55    *
56    * @param enc a <code>String</code> containing the name of
57    * the chararacter encoding.
58    *
59    * @exception java.io.UnsupportedEncodingException if this is not a valid encoding
60    * @exception java.lang.IllegalStateException if this method is called after
61    * reading request parameters or reading input using
62    * <code>getReader()</code>
63    */

64
65   public void setCharacterEncoding(String JavaDoc enc)
66     throws java.io.UnsupportedEncodingException JavaDoc;
67
68
69   /**
70    * Retrieves the body of the HTTP request from the client to the portal
71    * as character data using
72    * a <code>BufferedReader</code>. The reader translates the character
73    * data according to the character encoding used on the body.
74    * Either this method or {@link #getPortletInputStream} may be called to read the
75    * body, not both.
76    * <p>
77    * For HTTP POST data of type application/x-www-form-urlencoded
78    * this method throws an <code>IllegalStateException</code>
79    * as this data has been already processed by the
80    * portal/portlet-container and is available as request parameters.
81    *
82    * @return a <code>BufferedReader</code>
83    * containing the body of the request
84    *
85    * @exception java.io.UnsupportedEncodingException
86    * if the character set encoding used is
87    * not supported and the text cannot be decoded
88    * @exception java.lang.IllegalStateException
89    * if {@link #getPortletInputStream} method
90    * has been called on this request, it is a
91    * HTTP POST data of type application/x-www-form-urlencoded.
92    * @exception java.io.IOException
93    * if an input or output exception occurred
94    *
95    * @see #getPortletInputStream
96    */

97   
98   public java.io.BufferedReader JavaDoc getReader()
99     throws java.io.UnsupportedEncodingException JavaDoc, java.io.IOException JavaDoc;
100     
101     
102   /**
103    * Returns the name of the character encoding used in the body of this request.
104    * This method returns <code>null</code> if the request
105    * does not specify a character encoding.
106    *
107    * @return a <code>String</code> containing the name of
108    * the chararacter encoding, or <code>null</code>
109    * if the request does not specify a character encoding.
110    */

111   
112   public java.lang.String JavaDoc getCharacterEncoding();
113
114
115
116   /**
117    * Returns the MIME type of the body of the request,
118    * or null if the type is not known.
119    *
120    * @return a <code>String</code> containing the name
121    * of the MIME type of the request, or null
122    * if the type is not known.
123    */

124
125   public java.lang.String JavaDoc getContentType();
126
127
128   /**
129    * Returns the length, in bytes, of the request body
130    * which is made available by the input stream, or -1 if the
131    * length is not known.
132    *
133    *
134    * @return an integer containing the length of the
135    * request body or -1 if the length is not known
136    *
137    */

138
139   public int getContentLength();
140     
141
142     
143
144 }
145
Popular Tags