Package org.spincast.plugins.httpclient
Class HttpResponseDefault
java.lang.Object
org.spincast.plugins.httpclient.HttpResponseDefault
- All Implemented Interfaces:
HttpResponse
Spincast Http Client's reponse implementation.
-
Constructor Summary
ConstructorsConstructorDescriptionHttpResponseDefault(int status, String contentType, byte[] content, Map<String, List<String>> headers, Map<String, Cookie> cookies, boolean wasZipped, JsonManager jsonManager) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Get the content asbyte[].Gets the content as a JsonObject.Gets the content as aUTF-8String.getContentAsString(String encoding) Gets the content as a String using the specified encoding.Gets the Content-Type.Gets a cookie.Gets the cookies.getCookieValue(String name) Gets the value of a cookie.Gets an header.getHeaderFirst(String name) Gets the first value of an header.Gets the headers.protected JsonManagerintGets the HTTP status.booleanIs the response gzipped?toString()
-
Constructor Details
-
HttpResponseDefault
-
-
Method Details
-
getJsonManager
-
getStatus
public int getStatus()Description copied from interface:HttpResponseGets the HTTP status.- Specified by:
getStatusin interfaceHttpResponse
-
getContentType
Description copied from interface:HttpResponseGets the Content-Type.- Specified by:
getContentTypein interfaceHttpResponse
-
getContentAsString
Description copied from interface:HttpResponseGets the content as aUTF-8String.- Specified by:
getContentAsStringin interfaceHttpResponse
-
getContentAsString
Description copied from interface:HttpResponseGets the content as a String using the specified encoding.- Specified by:
getContentAsStringin interfaceHttpResponse
-
getContentAsJsonObject
Description copied from interface:HttpResponseGets the content as a JsonObject. This expects the content to be a valid Json string or an exception is thrown.- Specified by:
getContentAsJsonObjectin interfaceHttpResponse
-
getContentAsByteArray
public byte[] getContentAsByteArray()Description copied from interface:HttpResponseGet the content asbyte[].- Specified by:
getContentAsByteArrayin interfaceHttpResponse
-
getHeaders
Description copied from interface:HttpResponseGets the headers.- Specified by:
getHeadersin interfaceHttpResponse
-
getHeaderFirst
Description copied from interface:HttpResponseGets the first value of an header.- Specified by:
getHeaderFirstin interfaceHttpResponse
-
getHeader
Description copied from interface:HttpResponseGets an header. An header can have more than one value.- Specified by:
getHeaderin interfaceHttpResponse
-
getCookies
Description copied from interface:HttpResponseGets the cookies.- Specified by:
getCookiesin interfaceHttpResponse
-
getCookie
Description copied from interface:HttpResponseGets a cookie.- Specified by:
getCookiein interfaceHttpResponse
-
getCookieValue
Description copied from interface:HttpResponseGets the value of a cookie.- Specified by:
getCookieValuein interfaceHttpResponse- Returns:
- the value of the cookie or
nullif the cookie doesn't exist.
-
isGzipped
public boolean isGzipped()Description copied from interface:HttpResponseIs the response gzipped?- Specified by:
isGzippedin interfaceHttpResponse
-
toString
-