public.javadoc.org.spincast.plugins.httpclient.HttpResponseDefault.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
HttpResponseDefault (org.spincast:spincast-framework 2.1.1 API)
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
Constructor
Description
HttpResponseDefault(int status,
String contentType,
byte[] content,
Map<String,List<String>> headers,
Map<String,Cookie> cookies,
boolean wasZipped,
JsonManager jsonManager)
-
Method Summary
Modifier and Type
Method
Description
byte[]
Get the content as byte[]
.
Gets the content as a JsonObject.
Gets the content as a UTF-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 interface HttpResponse
-
getContentType
Description copied from interface: HttpResponse
Gets the Content-Type.
- Specified by:
getContentType
in interface HttpResponse
-
getContentAsString
Description copied from interface: HttpResponse
Gets the content as a UTF-8
String.
- Specified by:
getContentAsString
in interface HttpResponse
-
getContentAsString
Description copied from interface: HttpResponse
Gets the content as a String using the specified
encoding.
- Specified by:
getContentAsString
in interface HttpResponse
-
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 interface HttpResponse
-
getContentAsByteArray
public byte[] getContentAsByteArray()
Description copied from interface: HttpResponse
Get the content as byte[]
.
- Specified by:
getContentAsByteArray
in interface HttpResponse
-
getHeaders
Description copied from interface: HttpResponse
Gets the headers.
- Specified by:
getHeaders
in interface HttpResponse
-
getHeaderFirst
Description copied from interface: HttpResponse
Gets the first value of an header.
- Specified by:
getHeaderFirst
in interface HttpResponse
-
getHeader
Description copied from interface: HttpResponse
Gets an header. An header can have more than
one value.
- Specified by:
getHeader
in interface HttpResponse
-
getCookies
Description copied from interface: HttpResponse
Gets the cookies.
- Specified by:
getCookies
in interface HttpResponse
-
getCookie
Description copied from interface: HttpResponse
Gets a cookie.
- Specified by:
getCookie
in interface HttpResponse
-
getCookieValue
Description copied from interface: HttpResponse
Gets the value of a cookie.
- Specified by:
getCookieValue
in interface HttpResponse
- 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 interface HttpResponse
-
toString