|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.http.Response
public class Response
Represents a Response from an http Request. Instances of this class
are created as a result of executing a Request in a Session.
They are not created manually.
Responses can access all of the http Headers that were
returned with the response, as well as the status code, status message, and
response body. In addition, the url that this response originated from is
available. This is useful when constructing further requests based on relative
url paths.
As with Request, the body of the Response is
treated specially. Since the response may be very large (like, say, downloading
an operating system) it is critical that the responses not be cached. As a
result, once the response body has been read, any futher calls to getResponseBody
may result in an exception.
| Method Summary | |
|---|---|
String |
getBaseUrl()
Gets the url that was used to produce this Response. |
String |
getBody()
Gets the response body as a String. |
byte[] |
getBodyAsBytes()
Gets a byte array representing the body of the response. |
Reader |
getBodyAsReader()
Gets a Reader from which the body of the response may
be read. |
InputStream |
getBodyAsStream()
Gets an InputStream from which the body of the response may
be read. |
Header |
getHeader(String name)
Returns the Header with the given name, or null if there is no such header. |
Header[] |
getHeaders()
Gets an array of all the Headers for this Request. |
Date |
getLastModified()
Gets the Date specified in the Last-Modified header, if any. |
StatusCode |
getStatusCode()
Gets the status code. |
String |
getStatusText()
Returns the status text. |
String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public Header getHeader(String name)
name - the name to look for. This must not be null.
public Header[] getHeaders()
public Date getLastModified()
public StatusCode getStatusCode()
StatusCode for the definitive list of
status codes.
public String getStatusText()
public InputStream getBodyAsStream()
InputStream from which the body of the response may
be read.
public Reader getBodyAsReader()
Reader from which the body of the response may
be read.
public byte[] getBodyAsBytes()
public String getBody()
public String getBaseUrl()
Response. This
url will not contain a query string (that is, no parameters).
public String toString()
java.lang.ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||