Class SimpleHttpClientResponse
- java.lang.Object
-
- org.forgerock.http.client.response.SimpleHttpClientResponse
-
- All Implemented Interfaces:
HttpClientResponse
public class SimpleHttpClientResponse extends Object implements HttpClientResponse
A basic implementation ofHttpClientResponse
that a script can receive from sending aHttpClientRequest
over aHttpClient
.- Since:
- 12.0.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
getCookies()
Retrieve any cookies sent with the accessed resource.String
getEntity()
Retrieve the entity sent with the accessed resource.Map<String,String>
getHeaders()
Retrieve the headers sent with the accessed resource.String
getReasonPhrase()
Retrieve the reason phrase of the accessed resource.Integer
getStatusCode()
Retrieve the status code of the accessed resource.boolean
hasCookies()
Indicates if the accessed resource had cookies.boolean
hasHeaders()
Indicates if the accessed resource has headers.
-
-
-
Constructor Detail
-
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 Detail
-
getStatusCode
public Integer 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
public String 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
public Map<String,String> 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
public String 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
public Map<String,String> 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.
-
-