Package ai.preferred.venom.response
Class BaseResponse
- java.lang.Object
-
- ai.preferred.venom.response.BaseResponse
-
-
Constructor Summary
Constructors Constructor Description BaseResponse(int statusCode, String url, byte[] content, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] headers, org.apache.http.HttpHost proxy)
Constructs a base response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull String
getBaseUrl()
Returns the base form of the url used in this request.byte[]
getContent()
Returns raw content of the response.@NotNull org.apache.http.entity.ContentType
getContentType()
Returns the content type of the content fetched.@NotNull org.apache.http.Header[]
getHeaders()
Returns the headers that were used to trigger this response.org.apache.http.HttpHost
getProxy()
Returns the proxy that was used to trigger this response.int
getStatusCode()
Returns status code of the response.@NotNull String
getUrl()
Returns the url used to fetch the response, if the request is redirected, this will be the final requested url.
-
-
-
Constructor Detail
-
BaseResponse
public BaseResponse(int statusCode, String url, byte[] content, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] headers, org.apache.http.HttpHost proxy)
Constructs a base response.- Parameters:
statusCode
- Status code of the responseurl
- Base url of the responsecontent
- Content from the responsecontentType
- Content type of the responseheaders
- Headers from the responseproxy
- Proxy used to obtain the response
-
-
Method Detail
-
getStatusCode
public final int getStatusCode()
Description copied from interface:Response
Returns status code of the response.- Specified by:
getStatusCode
in interfaceResponse
- Returns:
- int code
-
getContent
public final byte[] getContent()
Description copied from interface:Response
Returns raw content of the response.- Specified by:
getContent
in interfaceResponse
- Returns:
- byte[] content
-
getContentType
@NotNull public final @NotNull org.apache.http.entity.ContentType getContentType()
Description copied from interface:Response
Returns the content type of the content fetched.This is provided by the server or guessed by the server or an amalgamation of both.
- Specified by:
getContentType
in interfaceResponse
- Returns:
- an instance of ContentType
-
getHeaders
@NotNull public final @NotNull org.apache.http.Header[] getHeaders()
Description copied from interface:Response
Returns the headers that were used to trigger this response.- Specified by:
getHeaders
in interfaceResponse
- Returns:
- an array of headers
-
getUrl
@NotNull public final @NotNull String getUrl()
Description copied from interface:Response
Returns the url used to fetch the response, if the request is redirected, this will be the final requested url.
-
getBaseUrl
@NotNull public final @NotNull String getBaseUrl()
Description copied from interface:Response
Returns the base form of the url used in this request.- Specified by:
getBaseUrl
in interfaceResponse
- Returns:
- stripped down version of requested url
-
-