|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.faceless.util.HttpResponseReader
public class HttpResponseReader
Represents an incoming HTTP Response, as created by an HttpRequestWriter
HttpRequestWriter,
HttpResponseWriter| Method Summary | |
|---|---|
void |
close()
Close the connection and free any resources associated with it |
void |
finalize()
|
String |
getContentType()
Returns the MIME type of the body of the request, or null if the type is not known. |
long |
getDateHeader(String key)
Returns the value of the specified response header as a long value that represents a Date object. |
String |
getHeader(String key)
Returns the value of the specified response header as a String. |
Iterator |
getHeaderNames()
Returns an iterator of all the header names this response contains. |
Iterator |
getHeaders(String key)
Returns all the values of the specified response header as an Iterator of String objects. |
InputStream |
getInputStream()
Returns the body of the response as binary data using an InputStream. |
int |
getIntHeader(String key)
Returns the value of the specified response header as an int. |
String |
getProtocol()
Get the protocol used for this response (eg. |
BufferedReader |
getReader()
Returns the body of the response as character data using a BufferedReader. |
HttpRequestWriter |
getRequestWriter()
Return the HttpRequestWriter object that created this
Response |
int |
getStatus()
Return the status code returned from the response. |
String |
getStatusMessage()
Get the status message returned from the response |
String |
getURL()
Get the URL that the response came from. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public int getStatus()
public String getStatusMessage()
public String getProtocol()
public String getURL()
public Iterator getHeaders(String key)
Returns all the values of the specified response header as an Iterator of String objects.
Some headers, such as Accept-Language can be sent by clients as several headers each with a different value rather than sending the header as a comma separated list.
If the response did not include any headers of the specified name, this method returns an empty Iterator. The header name is case insensitive. You can use this method with any response header.
key - a String specifying the header name
public Iterator getHeaderNames()
public String getHeader(String key)
key - a String specifying the name of a response header
public int getIntHeader(String key)
throws NumberFormatException
Returns the value of the specified response header as an int. If the response does not have a header of the specified name, this method returns -1. If the header cannot be converted to an integer, this method throws a NumberFormatException.
The header name is case insensitive.
key - a String specifying the name of a response header
NumberFormatException - if the header value can't be converted to an intpublic long getDateHeader(String key)
Returns the value of the specified response header as a long value that represents a Date object. Use this method with headers that contain dates, such as Last-Modified.
The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.
If the response did not have a header of the specified name, this method returns -1. If the header can't be converted to a date, the method throws an IllegalArgumentException.
key - a String specifying the name of a response header
IllegalArgumentException - if the header can't be converted to a datepublic String getContentType()
public InputStream getInputStream()
getReader() may be called to read the body,
but not both.
IllegalStateException - if the getReader() method has already been called.
public BufferedReader getReader()
throws UnsupportedEncodingException
getInputStream() may be called to read the body, but not both.
IllegalStateException - if the getInputStream() method has already been called.
UnsupportedEncodingException - if the character encoding is not supportedpublic void close()
public void finalize()
finalize in class Objectpublic HttpRequestWriter getRequestWriter()
HttpRequestWriter object that created this
Response
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||