Interface HttpRequestResponse
-
public interface HttpRequestResponse
Generically represents an HTTP request or response to/from a PingAuthorize endpoint on which an advice can operate.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addHeader(java.lang.String key, java.lang.String value)
Add a value to a header.void
addQueryParam(java.lang.String key, java.lang.String value)
Add a new value to the query parameter.HttpRequestResponse
copy()
Create a new HttpRequestResponse containing deep copies of this object's values.com.fasterxml.jackson.databind.JsonNode
getBody()
Get the parsed JSON body of the request/response.java.util.List<java.lang.String>
getHeader(java.lang.String key)
Get the values of a header provided to this request/response.javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>
getHeaders()
Get a copy of the headers provided to this request/response.java.lang.String
getHeaderString(java.lang.String key)
Get the value of a header provided to this request/response.java.util.List<java.lang.String>
getQueryParam(java.lang.String key)
Get the value(s) of a specific query parameter.javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>
getQueryParams()
Get the request's query parameters parsed as a map.java.net.URI
getUrl()
Get the URL that this request is pointed at, or null if a response.java.lang.String
getUrlString()
Get the URL that this request is pointed at, formatted as a string, or null if a response.void
setBody(com.fasterxml.jackson.databind.JsonNode body)
Set the contents of the request/response body.void
setHeader(java.lang.String key, java.lang.String value)
Set the value of a header to a single value.void
setHeader(java.lang.String key, java.util.List<java.lang.String> value)
Set the value of a header to multiple values.void
setHeaders(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> headers)
Set the request or response headers.void
setQueryParam(java.lang.String key, java.lang.String value)
Set a specific query parameter to a single value.void
setQueryParam(java.lang.String key, java.util.List<java.lang.String> values)
Set the value(s) of a specific query parameter.void
setQueryParams(java.util.Map<java.lang.String,java.util.List<java.lang.String>> params)
Set the query parameters of this request.void
setQueryParams(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> params)
Set the query parameters of this request.void
setUrl(java.net.URI url)
Set this request's URL.
-
-
-
Method Detail
-
getUrl
java.net.URI getUrl()
Get the URL that this request is pointed at, or null if a response.- Returns:
- The request URL (nullable).
-
getUrlString
java.lang.String getUrlString()
Get the URL that this request is pointed at, formatted as a string, or null if a response.- Returns:
- The request URL (nullable).
-
setUrl
void setUrl(java.net.URI url)
Set this request's URL.- Parameters:
url
- The request URL.
-
getQueryParams
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> getQueryParams()
Get the request's query parameters parsed as a map. Modifying the map will not modify this request; use this class's methods to set the request parameters. If there are no query parameters, or this object represents a response, an empty map will be returned.- Returns:
- The request query params.
-
getQueryParam
java.util.List<java.lang.String> getQueryParam(java.lang.String key)
Get the value(s) of a specific query parameter. Modifying the returned list will not modify this request; use this class's methods to set the request parameters.- Parameters:
key
- The query parameter to look up.- Returns:
- The value of the parameter, or null if it is not present.
-
setQueryParams
void setQueryParams(java.util.Map<java.lang.String,java.util.List<java.lang.String>> params) throws java.net.URISyntaxException
Set the query parameters of this request.- Parameters:
params
- The parameters to provide.- Throws:
java.net.URISyntaxException
- If the query parameters cannot be formatted.
-
setQueryParams
void setQueryParams(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> params) throws java.net.URISyntaxException
Set the query parameters of this request.- Parameters:
params
- The parameters to provide.- Throws:
java.net.URISyntaxException
- If the query parameters cannot be formatted.
-
setQueryParam
void setQueryParam(java.lang.String key, java.util.List<java.lang.String> values) throws java.net.URISyntaxException
Set the value(s) of a specific query parameter. To remove a parameter from the list, set the values to null.- Parameters:
key
- The parameter to set.values
- The values to set the parameter to.- Throws:
java.net.URISyntaxException
- If the query parameters cannot be formatted.
-
setQueryParam
void setQueryParam(java.lang.String key, java.lang.String value) throws java.net.URISyntaxException
Set a specific query parameter to a single value. Setting null will result in an empty parameter.- Parameters:
key
- The parameter to set.value
- The value to set the parameter to.- Throws:
java.net.URISyntaxException
- If the query parameters cannot be formatted.
-
addQueryParam
void addQueryParam(java.lang.String key, java.lang.String value) throws java.net.URISyntaxException
Add a new value to the query parameter. Passing null will result in an empty parameter.- Parameters:
key
- The parameter to set.value
- The value to set the parameter to.- Throws:
java.net.URISyntaxException
- If the query parameters cannot be formatted.
-
getHeaders
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> getHeaders()
Get a copy of the headers provided to this request/response. Modifying the map will not modify the request/response; use this class's methods to set the request/response headers. If no headers were provided, an empty map will be returned.- Returns:
- The request or response headers.
-
getHeader
java.util.List<java.lang.String> getHeader(java.lang.String key)
Get the values of a header provided to this request/response.- Parameters:
key
- The header to retrieve.- Returns:
- The values of the header, or null if the header is not present.
-
getHeaderString
java.lang.String getHeaderString(java.lang.String key)
Get the value of a header provided to this request/response. If the header has been provided multiple times, it will be concatenated with a semicolon.- Parameters:
key
- The header to retrieve.- Returns:
- The concatenated value of the header, or null if the header is not present.
-
setHeaders
void setHeaders(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> headers)
Set the request or response headers.- Parameters:
headers
- The headers to set.
-
setHeader
void setHeader(java.lang.String key, java.lang.String value)
Set the value of a header to a single value.- Parameters:
key
- The header to set.value
- The header value to set.
-
setHeader
void setHeader(java.lang.String key, java.util.List<java.lang.String> value)
Set the value of a header to multiple values.- Parameters:
key
- The header to set.value
- The header values to set.
-
addHeader
void addHeader(java.lang.String key, java.lang.String value)
Add a value to a header.- Parameters:
key
- The header to modify.value
- The value to add.
-
getBody
com.fasterxml.jackson.databind.JsonNode getBody()
Get the parsed JSON body of the request/response. May be null if the request or response does not have a body (such as a GET request).- Returns:
- The request or response body (nullable).
-
setBody
void setBody(com.fasterxml.jackson.databind.JsonNode body)
Set the contents of the request/response body.- Parameters:
body
- The request or response body.
-
copy
HttpRequestResponse copy()
Create a new HttpRequestResponse containing deep copies of this object's values.- Returns:
- A cloned HttpRequestResponse.
-
-