public class HttpResponse
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpResponse.ErrorSource
Enumeration of possible sources of response errors, or none if none.
|
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String[] |
_labels
Labels for returning the status as a RecordToken
|
Constructor and Description |
---|
HttpResponse()
Construct a new, blank HttpResponse object.
|
HttpResponse(java.net.HttpURLConnection connection)
Construct a new HttpResponse object from an HttpURLConnection object.
|
HttpResponse(java.lang.String message)
Construct a new HttpResponse with the given message.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getBody()
Return the response body.
|
long |
getContentLength()
Return the length of the response body, in bytes, or -1 if length is
unknown.
|
java.lang.String |
getContentType()
Return the Internet media (MIME) type of the response.
|
HttpResponse.ErrorSource |
getErrorSource()
Return the source of the error, ErrorSource.CLIENT or
ErrorSource.SERVER, or ErrorSource.NONE if no error.
|
int |
getResponseCode()
Return a code indicating the status of the response.
|
java.lang.String |
getResponseMessage()
A message describing the status of the response.
|
RecordToken |
getStatus()
Return all status items as a RecordToken.
|
static Type |
getStatusType()
Return the Type of the token of getStatus().
|
boolean |
isFurtherActionExpected()
Return true if further action is expected of the client, e.g., issuing
a second request; false otherwise.
|
boolean |
isSuccessful()
Return true if no errors were encountered; false otherwise.
|
void |
setTimedOut()
Create a timed-out response.
|
boolean |
timedOut()
Return true if the request timed out; false otherwise.
|
static final java.lang.String[] _labels
public HttpResponse()
public HttpResponse(java.lang.String message)
message
- The response messagepublic HttpResponse(java.net.HttpURLConnection connection)
connection
- The connection objectpublic java.lang.String getBody()
public long getContentLength()
public java.lang.String getContentType()
public HttpResponse.ErrorSource getErrorSource()
public int getResponseCode()
public java.lang.String getResponseMessage()
public RecordToken getStatus()
public static Type getStatusType()
public boolean isFurtherActionExpected()
public boolean isSuccessful()
public void setTimedOut()
public boolean timedOut()