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
ConstructorDescriptionHttpResponseDefault
(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-8
String.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 JsonManager
int
Gets the HTTP status.boolean
Is the response gzipped?toString()
-
Constructor Details
-
HttpResponseDefault
-
-
Method Details
-
getJsonManager
-
getStatus
public int getStatus()Description copied from interface:HttpResponse
Gets the HTTP status.- Specified by:
getStatus
in interfaceHttpResponse
-
getContentType
Description copied from interface:HttpResponse
Gets the Content-Type.- Specified by:
getContentType
in interfaceHttpResponse
-
getContentAsString
Description copied from interface:HttpResponse
Gets the content as aUTF-8
String.- Specified by:
getContentAsString
in interfaceHttpResponse
-
getContentAsString
Description copied from interface:HttpResponse
Gets the content as a String using the specified encoding.- Specified by:
getContentAsString
in interfaceHttpResponse
-
getContentAsJsonObject
Description copied from interface:HttpResponse
Gets the content as a JsonObject. This expects the content to be a valid Json string or an exception is thrown.- Specified by:
getContentAsJsonObject
in interfaceHttpResponse
-
getContentAsByteArray
public byte[] getContentAsByteArray()Description copied from interface:HttpResponse
Get the content asbyte[]
.- Specified by:
getContentAsByteArray
in interfaceHttpResponse
-
getHeaders
Description copied from interface:HttpResponse
Gets the headers.- Specified by:
getHeaders
in interfaceHttpResponse
-
getHeaderFirst
Description copied from interface:HttpResponse
Gets the first value of an header.- Specified by:
getHeaderFirst
in interfaceHttpResponse
-
getHeader
Description copied from interface:HttpResponse
Gets an header. An header can have more than one value.- Specified by:
getHeader
in interfaceHttpResponse
-
getCookies
Description copied from interface:HttpResponse
Gets the cookies.- Specified by:
getCookies
in interfaceHttpResponse
-
getCookie
Description copied from interface:HttpResponse
Gets a cookie.- Specified by:
getCookie
in interfaceHttpResponse
-
getCookieValue
Description copied from interface:HttpResponse
Gets the value of a cookie.- Specified by:
getCookieValue
in interfaceHttpResponse
- Returns:
- the value of the cookie or
null
if the cookie doesn't exist.
-
isGzipped
public boolean isGzipped()Description copied from interface:HttpResponse
Is the response gzipped?- Specified by:
isGzipped
in interfaceHttpResponse
-
toString
-