Package com.nimbusds.oauth2.sdk.http
Class HTTPRequest
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.http.HTTPRequest
-
- All Implemented Interfaces:
ReadOnlyHTTPMessage
,ReadOnlyHTTPRequest
@ThreadSafe public class HTTPRequest extends Object implements ReadOnlyHTTPRequest
HTTP request with support for the parameters required to construct anOAuth 2.0 request message
.Supported HTTP methods:
Supported request headers:
- Content-Type
- Authorization
- Accept
- Etc.
Supported timeouts:
- On HTTP connect
- On HTTP response read
HTTP 3xx redirection: follow (default) / don't follow
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HTTPRequest.Method
Enumeration of the HTTP methods used in OAuth 2.0 requests.
-
Constructor Summary
Constructors Constructor Description HTTPRequest(HTTPRequest.Method method, URI uri)
Creates a new minimally specified HTTP request.HTTPRequest(HTTPRequest.Method method, URL url)
Creates a new minimally specified HTTP request.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
appendQueryParameters(Map<String,List<String>> queryParams)
Appends the specified query parameters to the current HTTP requestURL
query.void
appendQueryString(String queryString)
Appends the specified raw (encoded) query string to the current HTTP requestURL
query.void
ensureEntityContentType()
Ensures this HTTP message has aContent-Type
header value.void
ensureEntityContentType(com.nimbusds.common.contenttype.ContentType contentType)
Ensures this HTTP message has the specifiedContent-Type
header value.void
ensureMethod(HTTPRequest.Method expectedMethod)
Ensures this HTTP request has the specified method.String
getAccept()
Gets theAccept
header value.String
getAuthorization()
Gets theAuthorization
header value.String
getBody()
Get the HTTP message body.Map<String,List<String>>
getBodyAsFormParameters()
Gets the response body as a form parameters map.net.minidev.json.JSONArray
getBodyAsJSONArray()
Gets the response content as a JSON array.net.minidev.json.JSONObject
getBodyAsJSONObject()
Gets the response body as a JSON object.com.nimbusds.jwt.JWT
getBodyAsJWT()
Gets the response body as a JSON Web Token (JWT).String
getClientIPAddress()
Gets the client IP address.X509Certificate
getClientX509Certificate()
Gets the received validated client X.509 certificate for a received HTTPS request.String
getClientX509CertificateRootDN()
Gets the root issuer DN of a received validated client X.509 certificate for a received HTTPS request.String
getClientX509CertificateSubjectDN()
Gets the subject DN of a received validated client X.509 certificate for a received HTTPS request.int
getConnectTimeout()
Gets the HTTP connect timeout.static HostnameVerifier
getDefaultHostnameVerifier()
Returns the default hostname verifier for all outgoing HTTPS requests.static SSLSocketFactory
getDefaultSSLSocketFactory()
Returns the default SSL socket factory for all outgoing HTTPS requests.com.nimbusds.jwt.SignedJWT
getDPoP()
Gets theDPoP
header value.com.nimbusds.common.contenttype.ContentType
getEntityContentType()
Gets theContent-Type
header value.boolean
getFollowRedirects()
Gets the boolean setting whether HTTP redirects (requests with response code 3xx) should be automatically followed.String
getFragment()
Deprecated.UsegetURL()
.Map<String,List<String>>
getHeaderMap()
Returns the HTTP headers.String
getHeaderValue(String name)
Gets an HTTP header's value.List<String>
getHeaderValues(String name)
Gets an HTTP header's value(s).HostnameVerifier
getHostnameVerifier()
Gets the hostname verifier for outgoing HTTPS requests.HTTPRequest.Method
getMethod()
Gets the request method.com.nimbusds.jwt.SignedJWT
getPoPWithException()
Gets theDPoP
header value.Proxy
getProxy()
Returns the proxy to use for this HTTP request.String
getQuery()
Deprecated.UsegetURL()
.net.minidev.json.JSONObject
getQueryAsJSONObject()
Deprecated.Map<String,List<String>>
getQueryParameters()
Deprecated.Map<String,List<String>>
getQueryStringParameters()
Gets the query string as a parameter map.int
getReadTimeout()
Gets the HTTP response read timeout.SSLSocketFactory
getSSLSocketFactory()
Gets the SSL factory for outgoing HTTPS requests.URI
getURI()
Gets the request URL as URI.URL
getURL()
Gets the request URL.HTTPResponse
send()
Sends this HTTP request to theURL
and retrieves the resulting HTTP response.HTTPResponse
send(HTTPRequestSender httpRequestSender)
Sends this HTTP request to theURL
and retrieves the resulting HTTP response.HTTPResponse
send(HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory)
Deprecated.void
setAccept(String accept)
Sets theAccept
header value.void
setAuthorization(String authz)
Sets theAuthorization
header value.void
setBody(String body)
Sets the HTTP message body.void
setClientIPAddress(String clientIPAddress)
Sets the client IP address.void
setClientX509Certificate(X509Certificate clientX509Certificate)
Sets the received validated client X.509 certificate for a received HTTPS request.void
setClientX509CertificateRootDN(String rootDN)
Sets the root issuer DN of a received validated client X.509 certificate for a received HTTPS request.void
setClientX509CertificateSubjectDN(String subjectDN)
Sets the subject DN of a received validated client X.509 certificate for a received HTTPS request.void
setConnectTimeout(int connectTimeout)
Sets the HTTP connect timeout.void
setContentType(String ct)
Sets theContent-Type
header value.static void
setDefaultHostnameVerifier(HostnameVerifier defaultHostnameVerifier)
Sets the default hostname verifier for all outgoing HTTPS requests.static void
setDefaultSSLSocketFactory(SSLSocketFactory sslSocketFactory)
Sets the default SSL socket factory for all outgoing HTTPS requests.void
setDPoP(com.nimbusds.jwt.SignedJWT dPoPJWT)
Sets theDPoP
header value.void
setEntityContentType(com.nimbusds.common.contenttype.ContentType ct)
Sets theContent-Type
header value.void
setFollowRedirects(boolean follow)
Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed.void
setFragment(String fragment)
Sets the raw (encoded) fragment of the URL.void
setHeader(String name, String... values)
Sets an HTTP header.void
setHostnameVerifier(HostnameVerifier hostnameVerifier)
Sets the hostname verifier for outgoing HTTPS requests.void
setProxy(Proxy proxy)
Tunnels this HTTP request via the specifiedProxy
by directly configuring the proxy on theURLConnection
.void
setQuery(String query)
Deprecated.void
setReadTimeout(int readTimeout)
Sets the HTTP response read timeout.void
setSSLSocketFactory(SSLSocketFactory sslSocketFactory)
Sets the SSL factory for outgoing HTTPS requests.HttpURLConnection
toHttpURLConnection()
Returns an established HTTP URL connection for this HTTP request.HttpURLConnection
toHttpURLConnection(HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory)
Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.nimbusds.oauth2.sdk.http.ReadOnlyHTTPMessage
getBody, getHeaderMap
-
-
-
-
Constructor Detail
-
HTTPRequest
public HTTPRequest(HTTPRequest.Method method, URL url)
Creates a new minimally specified HTTP request.- Parameters:
method
- The HTTP request method. Must not benull
.url
- The HTTP request URL. Must not benull
.
-
HTTPRequest
public HTTPRequest(HTTPRequest.Method method, URI uri)
Creates a new minimally specified HTTP request.- Parameters:
method
- The HTTP request method. Must not benull
.uri
- The HTTP request URI. Must be a URL and notnull
.
-
-
Method Detail
-
getMethod
public HTTPRequest.Method getMethod()
Gets the request method.- Specified by:
getMethod
in interfaceReadOnlyHTTPRequest
- Returns:
- The request method.
-
getURL
public URL getURL()
Gets the request URL.- Specified by:
getURL
in interfaceReadOnlyHTTPRequest
- Returns:
- The request URL.
-
getURI
public URI getURI()
Gets the request URL as URI.- Specified by:
getURI
in interfaceReadOnlyHTTPRequest
- Returns:
- The request URL as URI.
-
ensureMethod
public void ensureMethod(HTTPRequest.Method expectedMethod) throws ParseException
Ensures this HTTP request has the specified method.- Parameters:
expectedMethod
- The expected method. Must not benull
.- Throws:
ParseException
- If the method doesn't match the expected.
-
getAuthorization
public String getAuthorization()
Gets theAuthorization
header value.- Returns:
- The
Authorization
header value,null
if not specified.
-
setAuthorization
public void setAuthorization(String authz)
Sets theAuthorization
header value.- Parameters:
authz
- TheAuthorization
header value,null
if not specified.
-
getDPoP
public com.nimbusds.jwt.SignedJWT getDPoP()
Gets theDPoP
header value.- Returns:
- The
DPoP
header value,null
if not specified or parsing failed.
-
getPoPWithException
public com.nimbusds.jwt.SignedJWT getPoPWithException() throws ParseException
Gets theDPoP
header value.- Returns:
- The
DPoP
header value,null
if not specified. - Throws:
ParseException
- If JWT parsing failed.
-
setDPoP
public void setDPoP(com.nimbusds.jwt.SignedJWT dPoPJWT)
Sets theDPoP
header value.- Parameters:
dPoPJWT
- TheDPoP
header value,null
if not specified.
-
getAccept
public String getAccept()
Gets theAccept
header value.- Returns:
- The
Accept
header value,null
if not specified.
-
setAccept
public void setAccept(String accept)
Sets theAccept
header value.- Parameters:
accept
- TheAccept
header value,null
if not specified.
-
appendQueryParameters
public void appendQueryParameters(Map<String,List<String>> queryParams)
Appends the specified query parameters to the current HTTP requestURL
query.If the current URL has a query string the new query is appended with `&` in front.
- Parameters:
queryParams
- The query parameters to append, empty ornull
if nothing to append.- Throws:
IllegalArgumentException
- If the URL composition failed.
-
appendQueryString
public void appendQueryString(String queryString)
Appends the specified raw (encoded) query string to the current HTTP requestURL
query.If the current URL has a query string the new query is appended with `&` in front.
The '?' character preceding the query string must not be included.
Example query string to append:
client_id=123&logout_hint=eepaeph8siot&state=shah2key
- Parameters:
queryString
- The query string to append, blank ornull
if nothing to append.- Throws:
IllegalArgumentException
- If the URL composition failed.
-
getQuery
@Deprecated public String getQuery()
Deprecated.UsegetURL()
.Gets the raw (encoded) query string if the request is HTTP GET or the entity body if the request is HTTP POST.Note that the '?' character preceding the query string in GET requests is not included in the returned string.
Example query string (line breaks for clarity):
response_type=code &client_id=s6BhdRkqt3 &state=xyz &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
- Returns:
- For HTTP GET requests the URL query string, for HTTP POST
requests the body.
null
if not specified.
-
setQuery
@Deprecated public void setQuery(String query)
Deprecated.Sets the raw (encoded) query string if the request is HTTP GET or the entity body if the request is HTTP POST.Note that the '?' character preceding the query string in GET requests must not be included.
Example query string (line breaks for clarity):
response_type=code &client_id=s6BhdRkqt3 &state=xyz &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
- Parameters:
query
- For HTTP GET requests the URL query string, for HTTP POST requests the body.null
if not specified.
-
getQueryStringParameters
public Map<String,List<String>> getQueryStringParameters()
Gets the query string as a parameter map. The parameters are decoded according toapplication/x-www-form-urlencoded
.- Returns:
- The query string parameters to, decoded. If none the map will be empty.
-
getQueryParameters
@Deprecated public Map<String,List<String>> getQueryParameters()
Deprecated.Gets the request query as a parameter map. The parameters are decoded according toapplication/x-www-form-urlencoded
.- Returns:
- The request query parameters, decoded. If none the map will be empty.
-
getQueryAsJSONObject
@Deprecated public net.minidev.json.JSONObject getQueryAsJSONObject() throws ParseException
Deprecated.Gets the request query or entity body as a JSON Object.- Returns:
- The request query or entity body as a JSON object.
- Throws:
ParseException
- If the Content-Type header isn'tapplication/json
, the request query or entity body isnull
, empty or couldn't be parsed to a valid JSON object.
-
getFragment
@Deprecated public String getFragment()
Deprecated.UsegetURL()
.Gets the raw (encoded) fragment of the URL.- Returns:
- The fragment,
null
if not specified.
-
setFragment
public void setFragment(String fragment)
Sets the raw (encoded) fragment of the URL.- Parameters:
fragment
- The fragment,null
if not specified.
-
getConnectTimeout
public int getConnectTimeout()
Description copied from interface:ReadOnlyHTTPRequest
Gets the HTTP connect timeout.- Specified by:
getConnectTimeout
in interfaceReadOnlyHTTPRequest
- Returns:
- The HTTP connect timeout, in milliseconds. Zero implies no timeout.
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout)
Sets the HTTP connect timeout.- Parameters:
connectTimeout
- The HTTP connect timeout, in milliseconds. Zero implies no timeout. Must not be negative.
-
getReadTimeout
public int getReadTimeout()
Description copied from interface:ReadOnlyHTTPRequest
Gets the HTTP response read timeout.- Specified by:
getReadTimeout
in interfaceReadOnlyHTTPRequest
- Returns:
- The HTTP response read timeout, in milliseconds. Zero implies no timeout.
-
setReadTimeout
public void setReadTimeout(int readTimeout)
Sets the HTTP response read timeout.- Parameters:
readTimeout
- The HTTP response read timeout, in milliseconds. Zero implies no timeout. Must not be negative.
-
getProxy
public Proxy getProxy()
Returns the proxy to use for this HTTP request.- Returns:
- The connection specific proxy for this request,
null
for the default proxy strategy.
-
setProxy
public void setProxy(Proxy proxy)
Tunnels this HTTP request via the specifiedProxy
by directly configuring the proxy on theURLConnection
. The proxy is only used for this instance and bypasses any other proxy settings (such as set via System properties orProxySelector
). Supplyingnull
(the default) reverts to the default proxy strategy ofURLConnection
. If the goal is to avoid using a proxy at all supplyProxy.NO_PROXY
.- Parameters:
proxy
- The connection specific proxy to use,null
to use the default proxy strategy.- See Also:
URL.openConnection(Proxy)
-
getFollowRedirects
public boolean getFollowRedirects()
Gets the boolean setting whether HTTP redirects (requests with response code 3xx) should be automatically followed.- Returns:
true
if HTTP redirects are automatically followed, elsefalse
.
-
setFollowRedirects
public void setFollowRedirects(boolean follow)
Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed.- Parameters:
follow
-true
if HTTP redirects are automatically followed, elsefalse
.
-
getClientX509Certificate
public X509Certificate getClientX509Certificate()
Gets the received validated client X.509 certificate for a received HTTPS request.- Returns:
- The client X.509 certificate,
null
if not specified.
-
setClientX509Certificate
public void setClientX509Certificate(X509Certificate clientX509Certificate)
Sets the received validated client X.509 certificate for a received HTTPS request.- Parameters:
clientX509Certificate
- The client X.509 certificate,null
if not specified.
-
getClientX509CertificateSubjectDN
public String getClientX509CertificateSubjectDN()
Gets the subject DN of a received validated client X.509 certificate for a received HTTPS request.- Returns:
- The subject DN,
null
if not specified.
-
setClientX509CertificateSubjectDN
public void setClientX509CertificateSubjectDN(String subjectDN)
Sets the subject DN of a received validated client X.509 certificate for a received HTTPS request.- Parameters:
subjectDN
- The subject DN,null
if not specified.
-
getClientX509CertificateRootDN
public String getClientX509CertificateRootDN()
Gets the root issuer DN of a received validated client X.509 certificate for a received HTTPS request.- Returns:
- The root DN,
null
if not specified.
-
setClientX509CertificateRootDN
public void setClientX509CertificateRootDN(String rootDN)
Sets the root issuer DN of a received validated client X.509 certificate for a received HTTPS request.- Parameters:
rootDN
- The root DN,null
if not specified.
-
getHostnameVerifier
public HostnameVerifier getHostnameVerifier()
Gets the hostname verifier for outgoing HTTPS requests.- Returns:
- The hostname verifier,
null
implies use of thedefault one
.
-
setHostnameVerifier
public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
Sets the hostname verifier for outgoing HTTPS requests.- Parameters:
hostnameVerifier
- The hostname verifier,null
implies use of thedefault one
.
-
getSSLSocketFactory
public SSLSocketFactory getSSLSocketFactory()
Gets the SSL factory for outgoing HTTPS requests.- Returns:
- The SSL factory,
null
implies of the default one.
-
setSSLSocketFactory
public void setSSLSocketFactory(SSLSocketFactory sslSocketFactory)
Sets the SSL factory for outgoing HTTPS requests. Use theTLS utility
to set a custom trust store for server and CA certificates and / or a custom key store for client private keys and certificates, also to select a specific TLS protocol version.- Parameters:
sslSocketFactory
- The SSL factory,null
implies use of the default one.
-
getDefaultHostnameVerifier
public static HostnameVerifier getDefaultHostnameVerifier()
Returns the default hostname verifier for all outgoing HTTPS requests.- Returns:
- The hostname verifier.
-
setDefaultHostnameVerifier
public static void setDefaultHostnameVerifier(HostnameVerifier defaultHostnameVerifier)
Sets the default hostname verifier for all outgoing HTTPS requests. Can be overridden on a individual request basis.- Parameters:
defaultHostnameVerifier
- The hostname verifier. Must not benull
.
-
getDefaultSSLSocketFactory
public static SSLSocketFactory getDefaultSSLSocketFactory()
Returns the default SSL socket factory for all outgoing HTTPS requests.- Returns:
- The SSL socket factory.
-
setDefaultSSLSocketFactory
public static void setDefaultSSLSocketFactory(SSLSocketFactory sslSocketFactory)
Sets the default SSL socket factory for all outgoing HTTPS requests. Can be overridden on a individual request basis. Use theTLS utility
to set a custom trust store for server and CA certificates and / or a custom key store for client private keys and certificates, also to select a specific TLS protocol version.- Parameters:
sslSocketFactory
- The SSL socket factory. Must not benull
.
-
toHttpURLConnection
@Deprecated public HttpURLConnection toHttpURLConnection(HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory) throws IOException
Deprecated.Returns an established HTTP URL connection for this HTTP request. Deprecated as of v5.31, usetoHttpURLConnection()
withsetHostnameVerifier(javax.net.ssl.HostnameVerifier)
andsetSSLSocketFactory(javax.net.ssl.SSLSocketFactory)
instead.- Parameters:
hostnameVerifier
- The hostname verifier for outgoing HTTPS requests,null
implies use of thedefault one
.sslSocketFactory
- The SSL socket factory for HTTPS requests,null
implies use of thedefault one
.- Returns:
- The HTTP URL connection, with the request sent and ready to read the response.
- Throws:
IOException
- If the HTTP request couldn't be made, due to a network or other error.
-
toHttpURLConnection
public HttpURLConnection toHttpURLConnection() throws IOException
Returns an established HTTP URL connection for this HTTP request.- Returns:
- The HTTP URL connection, with the request sent and ready to read the response.
- Throws:
IOException
- If the HTTP request couldn't be made, due to a network or other error.
-
send
@Deprecated public HTTPResponse send(HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory) throws IOException
Deprecated.Sends this HTTP request to the request URL and retrieves the resulting HTTP response. Deprecated as of v5.31, usetoHttpURLConnection()
withsetHostnameVerifier(javax.net.ssl.HostnameVerifier)
andsetSSLSocketFactory(javax.net.ssl.SSLSocketFactory)
instead.- Parameters:
hostnameVerifier
- The hostname verifier for outgoing HTTPS requests,null
implies use of thedefault one
.sslSocketFactory
- The SSL socket factory for HTTPS requests,null
implies use of thedefault one
.- Returns:
- The resulting HTTP response.
- Throws:
IOException
- If the HTTP request couldn't be made, due to a network or other error.
-
send
public HTTPResponse send() throws IOException
Sends this HTTP request to theURL
and retrieves the resulting HTTP response.- Returns:
- The resulting HTTP response.
- Throws:
IOException
- If the HTTP request couldn't be sent, due to a network or another error.
-
send
public HTTPResponse send(HTTPRequestSender httpRequestSender) throws IOException
Sends this HTTP request to theURL
and retrieves the resulting HTTP response.- Parameters:
httpRequestSender
- The HTTP request sender. Must not benull
.- Returns:
- The resulting HTTP response.
- Throws:
IOException
- If the HTTP request couldn't be sent, due to a network or another error.
-
getEntityContentType
public com.nimbusds.common.contenttype.ContentType getEntityContentType()
Gets theContent-Type
header value.- Returns:
- The
Content-Type
header value,null
if not specified or parsing failed.
-
setEntityContentType
public void setEntityContentType(com.nimbusds.common.contenttype.ContentType ct)
Sets theContent-Type
header value.- Parameters:
ct
- TheContent-Type
header value,null
if not specified.
-
setContentType
public void setContentType(String ct) throws ParseException
Sets theContent-Type
header value.- Parameters:
ct
- TheContent-Type
header value,null
if not specified.- Throws:
ParseException
- If the header value couldn't be parsed to a valid content type.
-
ensureEntityContentType
public void ensureEntityContentType() throws ParseException
Ensures this HTTP message has aContent-Type
header value.- Throws:
ParseException
- If theContent-Type
header is missing.
-
ensureEntityContentType
public void ensureEntityContentType(com.nimbusds.common.contenttype.ContentType contentType) throws ParseException
Ensures this HTTP message has the specifiedContent-Type
header value. This method compares only the primary type and subtype; any content type parameters, such ascharset
, are ignored.- Parameters:
contentType
- The expected content type. Must not benull
.- Throws:
ParseException
- If theContent-Type
header is missing or its primary and subtype don't match.
-
getHeaderValue
public String getHeaderValue(String name)
Gets an HTTP header's value.- Parameters:
name
- The header name. Must not benull
.- Returns:
- The first header value,
null
if not specified.
-
getHeaderValues
public List<String> getHeaderValues(String name)
Gets an HTTP header's value(s).- Parameters:
name
- The header name. Must not benull
.- Returns:
- The header value(s),
null
if not specified.
-
setHeader
public void setHeader(String name, String... values)
Sets an HTTP header.- Parameters:
name
- The header name. Must not benull
.values
- The header value(s). Ifnull
and a header with the same name is specified, it will be deleted.
-
getHeaderMap
public Map<String,List<String>> getHeaderMap()
Description copied from interface:ReadOnlyHTTPMessage
Returns the HTTP headers.- Specified by:
getHeaderMap
in interfaceReadOnlyHTTPMessage
- Returns:
- The HTTP headers.
-
getBody
public String getBody()
Description copied from interface:ReadOnlyHTTPMessage
Get the HTTP message body.- Specified by:
getBody
in interfaceReadOnlyHTTPMessage
- Returns:
- The HTTP message body,
null
if not specified.
-
setBody
public void setBody(String body)
Sets the HTTP message body.- Parameters:
body
- The HTTP message body,null
if not specified.
-
getBodyAsFormParameters
public Map<String,List<String>> getBodyAsFormParameters() throws ParseException
Gets the response body as a form parameters map.- Returns:
- The form parameters as a map.
- Throws:
ParseException
- If the Content-Type header isn'tapplication/x-www-form-urlencoded
or the response couldn't be parsed to a valid form.
-
getBodyAsJSONObject
public net.minidev.json.JSONObject getBodyAsJSONObject() throws ParseException
Gets the response body as a JSON object.- Returns:
- The response body as a JSON object.
- Throws:
ParseException
- If the Content-Type header isn'tapplication/json
, the response body isnull
, empty or couldn't be parsed to a valid JSON object.
-
getBodyAsJSONArray
public net.minidev.json.JSONArray getBodyAsJSONArray() throws ParseException
Gets the response content as a JSON array.- Returns:
- The response content as a JSON array.
- Throws:
ParseException
- If the Content-Type header isn'tapplication/json
, the response content isnull
, empty or couldn't be parsed to a valid JSON array.
-
getBodyAsJWT
public com.nimbusds.jwt.JWT getBodyAsJWT() throws ParseException
Gets the response body as a JSON Web Token (JWT).- Returns:
- The response body as a JSON Web Token (JWT).
- Throws:
ParseException
- If the Content-Type header isn'tapplication/jwt
, the response content isnull
, empty or couldn't be parsed to a valid JSON Web Token (JWT).
-
getClientIPAddress
public String getClientIPAddress()
Gets the client IP address.- Returns:
- The client IP address,
null
if not specified.
-
setClientIPAddress
public void setClientIPAddress(String clientIPAddress)
Sets the client IP address.- Parameters:
clientIPAddress
- The client IP address,null
if not specified.
-
-