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 1.13.0 API)
org.spincast.plugins.httpclient
Class HttpResponseDefault
- java.lang.Object
-
- org.spincast.plugins.httpclient.HttpResponseDefault
-
- All Implemented Interfaces:
- HttpResponse
public class HttpResponseDefault
extends Object
implements HttpResponse
Spincast Http Client's reponse implementation.
-
-
Constructor Summary
Constructors
Constructor and Description
HttpResponseDefault(int status,
String contentType,
byte[] content,
Map<String,List<String>> headers,
Map<String,Cookie> cookies,
boolean wasZipped,
JsonManager jsonManager)
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
byte[]
getContentAsByteArray()
Get the content as byte[]
.
JsonObject
getContentAsJsonObject()
Gets the content as a JsonObject.
String
getContentAsString()
Gets the content as a UTF-8
String.
String
getContentAsString(String encoding)
Gets the content as a String using the specified
encoding.
String
getContentType()
Gets the Content-Type.
Cookie
getCookie(String name)
Gets a cookie.
Map<String,Cookie>
getCookies()
Gets the cookies.
String
getCookieValue(String name)
Gets the value of a cookie.
List<String>
getHeader(String name)
Gets an header.
String
getHeaderFirst(String name)
Gets the first value of an header.
Map<String,List<String>>
getHeaders()
Gets the headers.
protected JsonManager
getJsonManager()
int
getStatus()
Gets the HTTP status.
boolean
isGzipped()
Is the response gzipped?
String
toString()
-
-
Method Detail
-
getJsonManager
protected JsonManager getJsonManager()
-
getStatus
public int getStatus()
Description copied from interface: HttpResponse
Gets the HTTP status.
- Specified by:
getStatus
in interface HttpResponse
-
getContentType
public String getContentType()
Description copied from interface: HttpResponse
Gets the Content-Type.
- Specified by:
getContentType
in interface HttpResponse
-
getContentAsString
public String getContentAsString()
Description copied from interface: HttpResponse
Gets the content as a UTF-8
String.
- Specified by:
getContentAsString
in interface HttpResponse
-
getContentAsString
public String getContentAsString(String encoding)
Description copied from interface: HttpResponse
Gets the content as a String using the specified
encoding.
- Specified by:
getContentAsString
in interface HttpResponse
-
getContentAsJsonObject
public JsonObject 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
public Map<String,List<String>> getHeaders()
Description copied from interface: HttpResponse
Gets the headers.
- Specified by:
getHeaders
in interface HttpResponse
-
getHeaderFirst
public String getHeaderFirst(String name)
Description copied from interface: HttpResponse
Gets the first value of an header.
- Specified by:
getHeaderFirst
in interface HttpResponse
-
getHeader
public List<String> getHeader(String name)
Description copied from interface: HttpResponse
Gets an header. An header can have more than
one value.
- Specified by:
getHeader
in interface HttpResponse
-
getCookies
public Map<String,Cookie> getCookies()
Description copied from interface: HttpResponse
Gets the cookies.
- Specified by:
getCookies
in interface HttpResponse
-
getCookie
public Cookie getCookie(String name)
Description copied from interface: HttpResponse
Gets a cookie.
- Specified by:
getCookie
in interface HttpResponse
-
getCookieValue
public String getCookieValue(String name)
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
Copyright © 2019. All rights reserved.