public final class HttpResponse extends Object implements Externalizable
| Constructor and Description |
|---|
HttpResponse()
Needed for serialization.
|
HttpResponse(String body) |
| Modifier and Type | Method and Description |
|---|---|
static HttpResponse |
badrequest(String msg) |
boolean |
equals(Object obj) |
static HttpResponse |
error() |
long |
getCacheExpiration()
Calculate the Cache Expiration for this response.
|
long |
getCacheTtl() |
int |
getContentLength() |
long |
getDefaultTtl()
returns the default TTL for responses.
|
String |
getEncoding() |
Charset |
getEncodingCharset() |
String |
getHeader(String name) |
com.google.common.collect.Multimap<String,String> |
getHeaders() |
Collection<String> |
getHeaders(String name) |
int |
getHttpStatusCode() |
Map<String,String> |
getMetadata() |
InputStream |
getResponse() |
String |
getResponseAsString()
Attempts to convert the response body to a string using the Content-Type header.
|
static TimeSource |
getTimeSource() |
int |
hashCode() |
boolean |
isError() |
boolean |
isStale() |
boolean |
isStrictNoCache() |
static com.google.common.collect.Multimap<String,String> |
newHeaderMultimap() |
static HttpResponse |
notFound() |
void |
readExternal(ObjectInput in)
Expected layout:
int - status code
Map
|
static void |
setTimeSource(TimeSource timeSource) |
static HttpResponse |
timeout() |
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public static final int SC_CONTINUE
public static final int SC_SWITCHING_PROTOCOLS
public static final int SC_OK
public static final int SC_CREATED
public static final int SC_ACCEPTED
public static final int SC_NON_AUTHORITATIVE_INFORMATION
public static final int SC_NO_CONTENT
public static final int SC_RESET_CONTENT
public static final int SC_PARTIAL_CONTENT
public static final int SC_MULTIPLE_CHOICES
public static final int SC_MOVED_PERMANENTLY
public static final int SC_FOUND
public static final int SC_SEE_OTHER
public static final int SC_NOT_MODIFIED
public static final int SC_USE_PROXY
public static final int SC_TEMPORARY_REDIRECT
public static final int SC_BAD_REQUEST
public static final int SC_UNAUTHORIZED
public static final int SC_PAYMENT_REQUIRED
public static final int SC_FORBIDDEN
public static final int SC_NOT_FOUND
public static final int SC_METHOD_NOT_ALLOWED
public static final int SC_NOT_ACCEPTABLE
public static final int SC_PROXY_AUTHENTICATION_REQUIRED
public static final int SC_REQUEST_TIMEOUT
public static final int SC_CONFLICT
public static final int SC_GONE
public static final int SC_LENGTH_REQUIRED
public static final int SC_PRECONDITION_FAILED
public static final int SC_REQUEST_ENTITY_TOO_LARGE
public static final int SC_REQUEST_URI_TOO_LONG
public static final int SC_UNSUPPORTED_MEDIA_TYPE
public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE
public static final int SC_EXPECTATION_FAILED
public static final int SC_INTERNAL_SERVER_ERROR
public static final int SC_NOT_IMPLEMENTED
public static final int SC_BAD_GATEWAY
public static final int SC_SERVICE_UNAVAILABLE
public static final int SC_GATEWAY_TIMEOUT
public static final int SC_HTTP_VERSION_NOT_SUPPORTED
public HttpResponse()
public HttpResponse(String body)
public static void setTimeSource(TimeSource timeSource)
public static TimeSource getTimeSource()
public static HttpResponse error()
public static HttpResponse badrequest(String msg)
public static HttpResponse timeout()
public static HttpResponse notFound()
public int getHttpStatusCode()
public boolean isError()
public String getEncoding()
public Charset getEncodingCharset()
public int getContentLength()
public InputStream getResponse()
public String getResponseAsString()
public com.google.common.collect.Multimap<String,String> getHeaders()
public Collection<String> getHeaders(String name)
public String getHeader(String name)
public Map<String,String> getMetadata()
public long getCacheExpiration()
public long getCacheTtl()
public boolean isStale()
public boolean isStrictNoCache()
public long getDefaultTtl()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionCopyright © 2007-2012. All Rights Reserved.