Class SimpleHttpClientResponse
java.lang.Object
org.forgerock.http.client.response.SimpleHttpClientResponse
- All Implemented Interfaces:
HttpClientResponse
A basic implementation of
HttpClientResponse
that a script can receive from sending a
HttpClientRequest
over a HttpClient
.- Since:
- 12.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieve any cookies sent with the accessed resource.Retrieve the entity sent with the accessed resource.Retrieve the headers sent with the accessed resource.Retrieve the reason phrase of the accessed resource.Retrieve the status code of the accessed resource.boolean
Indicates if the accessed resource had cookies.boolean
Indicates if the accessed resource has headers.
-
Constructor Details
-
SimpleHttpClientResponse
public SimpleHttpClientResponse(Integer statusCode, String reasonPhrase, Map<String, String> headers, String messageBody, Map<String, String> cookies) Creates a representation of an HTTP/1.1 response. Any or all of the fields can be set as null if desired.- Parameters:
statusCode
- The three digit integer that corresponds to the HTTP status code.reasonPhrase
- The HTTP reason phrase.headers
- Any headers sent with the accessed resource.messageBody
- The entity sent with the accessed resource.cookies
- Any cookies sent with the accessed resource.
-
-
Method Details
-
getStatusCode
Retrieve the status code of the accessed resource.- Specified by:
getStatusCode
in interfaceHttpClientResponse
- Returns:
- A three digit integer that corresponds to an HTTP status code. Can be null if no status code was set.
-
getReasonPhrase
Retrieve the reason phrase of the accessed resource.- Specified by:
getReasonPhrase
in interfaceHttpClientResponse
- Returns:
- The HTTP reason phrase. Can be null if no status code was set.
-
hasHeaders
public boolean hasHeaders()Indicates if the accessed resource has headers.- Specified by:
hasHeaders
in interfaceHttpClientResponse
- Returns:
- True if the accessed resource has headers.
-
getHeaders
Retrieve the headers sent with the accessed resource.- Specified by:
getHeaders
in interfaceHttpClientResponse
- Returns:
- The headers sent with the accessed resource. Can be implemented as returning null or an empty map in the absence of any headers.
-
getEntity
Retrieve the entity sent with the accessed resource.- Specified by:
getEntity
in interfaceHttpClientResponse
- Returns:
- The entity sent with the accessed resource. Can be null if no entity was set.
-
hasCookies
public boolean hasCookies()Indicates if the accessed resource had cookies.- Specified by:
hasCookies
in interfaceHttpClientResponse
- Returns:
- True if the accessed resource had cookies.
-
getCookies
Retrieve any cookies sent with the accessed resource.- Specified by:
getCookies
in interfaceHttpClientResponse
- Returns:
- Any cookies sent with the accessed resource. Can be implemented as returning null or an empty map in the absence of any cookies.
-