Package org.gatein.pc.api.spi
Interface RequestContext
-
public interface RequestContext- Version:
- $Revision: 630 $
- Author:
- Julien Viet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetCharacterEncoding()Returns the name of the character encoding used in the body of this request.intgetContentLength()Returns the length, in bytes, of the request body which is made available by the input stream, or -1 if the length is not known.StringgetContentType()Returns the MIME type of the body of the request, or null if the type is not known.InputStreamgetInputStream()Retrieves the body of the HTTP request from client to portal as binary data using anInputStream.BufferedReadergetReader()Retrieves the body of the HTTP request from the client to the portal as character data using aBufferedReader.
-
-
-
Method Detail
-
getCharacterEncoding
String getCharacterEncoding()
Returns the name of the character encoding used in the body of this request. This method returnsnullif the request does not specify a character encoding.- Returns:
- a
Stringcontaining the name of the chararacter encoding, ornullif the request does not specify a character encoding.
-
getContentLength
int getContentLength()
Returns the length, in bytes, of the request body which is made available by the input stream, or -1 if the length is not known.- Returns:
- an integer containing the length of the request body or -1 if the length is not known
-
getContentType
String getContentType()
Returns the MIME type of the body of the request, or null if the type is not known.- Returns:
- a
Stringcontaining the name of the MIME type of the request, or null if the type is not known.
-
getReader
BufferedReader getReader() throws IOException
Retrieves the body of the HTTP request from the client to the portal as character data using aBufferedReader. The reader translates the character data according to the character encoding used on the body. Either this method orgetInputStream()may be called to read the body, not both. For HTTP POST data of type application/x-www-form-urlencoded this method throws anIllegalStateExceptionas this data has been already processed by the portal/portlet-container and is available as request parameters.- Returns:
- a
BufferedReadercontaining the body of the request - Throws:
UnsupportedEncodingException- if the character set encoding used is not supported and the text cannot be decodedIllegalStateException- ifgetInputStream()method has been called on this request, it is a HTTP POST data of type application/x-www-form-urlencoded.IOException- if an input or output exception occurred- See Also:
getInputStream()
-
getInputStream
InputStream getInputStream() throws IOException, IllegalStateException
Retrieves the body of the HTTP request from client to portal as binary data using anInputStream. Either this method orgetReader()may be called to read the body, but not both. For HTTP POST data of type application/x-www-form-urlencoded this method throws anIllegalStateExceptionas this data has been already processed by the portal/portlet-container and is available as request parameters.- Returns:
- an input stream containing the body of the request
- Throws:
IllegalStateException- if getReader was already called, or it is a HTTP POST data of type application/x-www-form-urlencodedIOException- if an input or output exception occurred
-
-