|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shindig.gadgets.http.HttpResponse
public final class HttpResponse
Represents the results of an HTTP content retrieval operation. HttpResponse objects are immutable in order to allow them to be safely used in concurrent caches and by multiple threads without worrying about concurrent modification.
| Constructor Summary | |
|---|---|
HttpResponse()
Needed for serialization. |
|
HttpResponse(String body)
|
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public HttpResponse()
public HttpResponse(String body)
| Method Detail |
|---|
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 int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Object
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOExceptionpublic static com.google.common.collect.Multimap<String,String> newHeaderMultimap()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||