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
Constructors -
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.booleanIndicates if the accessed resource had cookies.booleanIndicates 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:
getStatusCodein 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:
getReasonPhrasein 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:
hasHeadersin interfaceHttpClientResponse- Returns:
- True if the accessed resource has headers.
-
getHeaders
Retrieve the headers sent with the accessed resource.- Specified by:
getHeadersin 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:
getEntityin 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:
hasCookiesin interfaceHttpClientResponse- Returns:
- True if the accessed resource had cookies.
-
getCookies
Retrieve any cookies sent with the accessed resource.- Specified by:
getCookiesin 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.
-