org.refcodes.component.Closable
, org.refcodes.component.Closable.CloseBuilder<org.refcodes.web.RequestHeaderFields>
, org.refcodes.component.ConnectionStatusAccessor
, org.refcodes.component.LinkComponent
, org.refcodes.component.LinkComponent.LinkComponentBuilder<RestResponseResult>
, org.refcodes.component.Openable
, org.refcodes.component.Openable.OpenBuilder<org.refcodes.web.RequestHeaderFields>
, org.refcodes.component.OpenedAccessor
, org.refcodes.io.IoResultAccessor<RestResponse,InterruptedException>
, org.refcodes.mixin.ResponseAccessor<RestResponse>
, org.refcodes.mixin.ResultAccessor<org.refcodes.web.RequestHeaderFields,RestResponseResult>
, RestResponseConsumer
, org.refcodes.web.HeaderFieldsAccessor<org.refcodes.web.RequestHeaderFields>
, org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsBuilder<org.refcodes.web.RequestHeaderFields,RestResponseResult>
, org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.web.RequestHeaderFields>
, org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsProperty<org.refcodes.web.RequestHeaderFields>
, org.refcodes.web.HttpBodyAccessor.HttpBodyProvider<org.refcodes.web.RequestHeaderFields>
, org.refcodes.web.HttpClientRequest
, org.refcodes.web.HttpClientRequest.HttpClientRequestBuilder
, org.refcodes.web.HttpMethodAccessor
, org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestResponseResult>
, org.refcodes.web.HttpMethodAccessor.HttpMethodMutator
, org.refcodes.web.HttpMethodAccessor.HttpMethodProperty
, org.refcodes.web.HttpRequest
, org.refcodes.web.HttpRequestBuilder<RestResponseResult>
, org.refcodes.web.QueryFieldsAccessor
, org.refcodes.web.QueryFieldsAccessor.QueryFieldsMutator
, org.refcodes.web.QueryFieldsAccessor.QueryFieldsProperty
, org.refcodes.web.RedirectDepthAccessor
, org.refcodes.web.RedirectDepthAccessor.RedirectDepthBuilder<org.refcodes.web.RequestHeaderFields>
, org.refcodes.web.RedirectDepthAccessor.RedirectDepthMutator
, org.refcodes.web.RedirectDepthAccessor.RedirectDepthProperty
, org.refcodes.web.UrlAccessor
, org.refcodes.web.UrlAccessor.UrlBuilder
, org.refcodes.web.UrlAccessor.UrlMutator
public class RestResponseResult extends org.refcodes.web.HttpClientRequestImpl implements RestResponseConsumer, org.refcodes.web.HttpClientRequest, org.refcodes.web.QueryFieldsAccessor.QueryFieldsProperty, org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsProperty<org.refcodes.web.RequestHeaderFields>, org.refcodes.web.HttpClientRequest.HttpClientRequestBuilder, org.refcodes.web.HttpRequestBuilder<RestResponseResult>, org.refcodes.web.HttpMethodAccessor.HttpMethodProperty, org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestResponseResult>, org.refcodes.component.LinkComponent.LinkComponentBuilder<RestResponseResult>, org.refcodes.component.ConnectionStatusAccessor, org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsBuilder<org.refcodes.web.RequestHeaderFields,RestResponseResult>, org.refcodes.io.IoResultAccessor<RestResponse,InterruptedException>, org.refcodes.mixin.ResponseAccessor<RestResponse>
RestResponseResult
handles a REST request asynchronously on the
RestClient
instance's side to do the actual technical implementation
of sending that request (or mocking the send-out of a request).org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
org.refcodes.web.HttpClientRequest.HttpClientRequestBuilder
org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.web.HttpMethodAccessor.HttpMethodMutator, org.refcodes.web.HttpMethodAccessor.HttpMethodProperty
org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.LinkComponent.LinkComponentBuilder<B extends org.refcodes.component.LinkComponent.LinkComponentBuilder<B>>
org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<B extends org.refcodes.component.Openable.OpenBuilder<B>>
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
org.refcodes.web.QueryFieldsAccessor.QueryFieldsBuilder<B extends org.refcodes.web.QueryFieldsAccessor.QueryFieldsBuilder<?>>, org.refcodes.web.QueryFieldsAccessor.QueryFieldsMutator, org.refcodes.web.QueryFieldsAccessor.QueryFieldsProperty
org.refcodes.web.RedirectDepthAccessor.RedirectDepthBuilder<B extends org.refcodes.web.RedirectDepthAccessor.RedirectDepthBuilder<B>>, org.refcodes.web.RedirectDepthAccessor.RedirectDepthMutator, org.refcodes.web.RedirectDepthAccessor.RedirectDepthProperty
org.refcodes.mixin.ResponseAccessor.ResponseBuilder<RES extends Object,B extends org.refcodes.mixin.ResponseAccessor.ResponseBuilder<RES,B>>, org.refcodes.mixin.ResponseAccessor.ResponseMutator<RES extends Object>, org.refcodes.mixin.ResponseAccessor.ResponseProperty<RES extends Object>
org.refcodes.mixin.ResultAccessor.ResultBuilder<RES extends Object,B extends org.refcodes.mixin.ResultAccessor.ResultBuilder<RES,B>>, org.refcodes.mixin.ResultAccessor.ResultMutator<RES extends Object>, org.refcodes.mixin.ResultAccessor.ResultProperty<RES extends Object,EXC extends Exception>
Constructor | Description |
---|---|
RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod,
org.refcodes.web.Url aUrl,
int aRedirectDepth,
org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
Instantiates a new
RestResponseResult . |
RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod,
org.refcodes.web.Url aUrl,
Object aRequest,
int aRedirectDepth,
org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
Instantiates a new
RestResponseResult . |
RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod,
org.refcodes.web.Url aUrl,
Object aRequest,
org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
Instantiates a new
RestResponseResult . |
RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod,
org.refcodes.web.Url aUrl,
org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
Instantiates a new
RestResponseResult . |
RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod,
org.refcodes.web.Url aUrl,
org.refcodes.web.RequestHeaderFields aHeaderFields,
Object aRequest,
int aRedirectDepth,
org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
Instantiates a new
RestResponseResult . |
RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod,
org.refcodes.web.Url aUrl,
org.refcodes.web.RequestHeaderFields aHeaderFields,
Object aRequest,
org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
Instantiates a new
RestResponseResult . |
RestResponseResult(org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
Instantiates a new
RestResponseResult . |
Modifier and Type | Method | Description |
---|---|---|
RestResponseResult |
build(RestClient aRestClient) |
This is a convenience method for easily instantiating the according
builder.
|
void |
close() |
|
org.refcodes.component.ConnectionStatus |
getConnectionStatus() |
|
org.refcodes.web.HttpMethod |
getHttpMethod() |
|
org.refcodes.web.FormFields |
getQueryFields() |
|
RestResponse |
getResponse() |
This method retrieves the received
RestResponse . |
RestResponse |
getResult() |
Returns the expected
RestResponse result, if none result is
available it blocks until one is available (or this instance is notified
via Object.notifyAll() or one of the close() methods). |
org.refcodes.web.Url |
getUrl() |
|
boolean |
hasResult() |
Tests whether there is already a HTTP-Response
|
void |
onResponse(RestResponseEvent aResponse) |
The invoker provides a response context being a
RestResponseEvent
describing the response being processed upon by your
lambda 's code. |
void |
open() |
|
void |
setHeaderFields(org.refcodes.web.RequestHeaderFields aHeaderFields) |
|
void |
setHttpMethod(org.refcodes.web.HttpMethod aHttpMethod) |
|
void |
setQueryFields(org.refcodes.web.FormFields aQueryFields) |
|
void |
setUrl(org.refcodes.web.Url aUrl) |
|
String |
toString() |
|
RestResponseResult |
withClose() |
|
RestResponseResult |
withCloseIn(int aCloseInMillis) |
|
RestResponseResult |
withCloseQuietly() |
|
RestResponseResult |
withHeaderFields(org.refcodes.web.RequestHeaderFields aRequestHeaderFields) |
|
RestResponseResult |
withHttpMethod(org.refcodes.web.HttpMethod aHttpMethod) |
|
RestResponseResult |
withOpen() |
|
<REQ> RestResponseResult |
withRequest(REQ aRequest) |
|
RestResponseResult |
withUrl(org.refcodes.web.Url aUrl) |
closeIn, closeQuietly, closeUnchecked
letHeaderFields
getRequest, setRequest, toHttpBody
withRedirectDepth
getRedirectDepth, getRequest, setRedirectDepth, setRequest, toHttpBody
letHttpMethod
withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToQueryFields, withAddToQueryFields, withAddToQueryFields
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
letQueryFields
setRedirectDepth
public RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, Object aRequest, int aRedirectDepth, org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
RestResponseResult
.aHttpMethod
- the http methodaUrl
- The Url
from which to take the URL specific data.aRequest
- the requestaRedirectDepth
- The redirect depth provides the count of
HTTP-Request and HTTP-Response cycles where the response
represents a redirect as of
HttpStatusCode.isRedirectStatus()
. A value of -1
represents the default behavior, e.g. using
HttpURLConnection
's redirection means.aMediaTypeFactoryLookup
- the media type factory lookuppublic RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, Object aRequest, org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
RestResponseResult
.aHttpMethod
- the http methodaUrl
- The Url
from which to take the URL specific data.aRequest
- the requestaMediaTypeFactoryLookup
- the media type factory lookuppublic RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aHeaderFields, Object aRequest, int aRedirectDepth, org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
RestResponseResult
.aHttpMethod
- the http methodaUrl
- The Url
from which to take the URL specific data.aHeaderFields
- the Header-FieldsaRequest
- the requestaRedirectDepth
- The redirect depth provides the count of
HTTP-Request and HTTP-Response cycles where the response
represents a redirect as of
HttpStatusCode.isRedirectStatus()
. A value of -1
represents the default behavior, e.g. using
HttpURLConnection
's redirection means.aMediaTypeFactoryLookup
- the media type factory lookuppublic RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.RequestHeaderFields aHeaderFields, Object aRequest, org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
RestResponseResult
.aHttpMethod
- the http methodaUrl
- The Url
from which to take the URL specific data.aHeaderFields
- the Header-FieldsaRequest
- the requestaMediaTypeFactoryLookup
- the media type factory lookuppublic RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, int aRedirectDepth, org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
RestResponseResult
.aHttpMethod
- the http methodaUrl
- The Url
from which to take the URL specific data.aRedirectDepth
- The redirect depth provides the count of
HTTP-Request and HTTP-Response cycles where the response
represents a redirect as of
HttpStatusCode.isRedirectStatus()
. A value of -1
represents the default behavior, e.g. using
HttpURLConnection
's redirection means.aMediaTypeFactoryLookup
- the media type factory lookuppublic RestResponseResult(org.refcodes.web.HttpMethod aHttpMethod, org.refcodes.web.Url aUrl, org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
RestResponseResult
.aHttpMethod
- the http methodaUrl
- The Url
from which to take the URL specific data.aMediaTypeFactoryLookup
- the media type factory lookuppublic RestResponseResult(org.refcodes.web.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
RestResponseResult
.aMediaTypeFactoryLookup
- the media type factory lookuppublic RestResponse getResult() throws InterruptedException
RestResponse
result, if none result is
available it blocks until one is available (or this instance is notified
via Object.notifyAll()
or one of the close()
methods). To test
for a result, call hasResult()
. The method getResult()
does not block and returns null if there is no result available yet.getResult
in interface org.refcodes.mixin.ResultAccessor<org.refcodes.web.RequestHeaderFields,RestResponseResult>
RestResponse
as soon as it is available.InterruptedException
- thrown in case this blocking method is
interrupted by invoking Object.notifyAll()
.public RestResponse getResponse()
RestResponse
. It does not
block and returns null if there is no result available yet. To block till
a result is available, please call getResult()
. getResponse
in interface org.refcodes.mixin.ResponseAccessor<RestResponse>
public org.refcodes.web.HttpMethod getHttpMethod()
getHttpMethod
in interface org.refcodes.web.HttpMethodAccessor
getHttpMethod
in class org.refcodes.web.HttpRequestImpl
public void setHttpMethod(org.refcodes.web.HttpMethod aHttpMethod)
setHttpMethod
in interface org.refcodes.web.HttpMethodAccessor.HttpMethodMutator
public void open() throws IOException
open
in interface org.refcodes.component.Openable
IOException
public void close() throws IOException
close
in interface org.refcodes.component.Closable
IOException
public org.refcodes.component.ConnectionStatus getConnectionStatus()
getConnectionStatus
in interface org.refcodes.component.ConnectionStatusAccessor
public void setHeaderFields(org.refcodes.web.RequestHeaderFields aHeaderFields)
setHeaderFields
in interface org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.web.RequestHeaderFields>
public org.refcodes.web.Url getUrl()
getUrl
in interface org.refcodes.web.UrlAccessor
getUrl
in class org.refcodes.web.HttpRequestImpl
public void setUrl(org.refcodes.web.Url aUrl)
setUrl
in interface org.refcodes.web.UrlAccessor.UrlMutator
public boolean hasResult()
hasResult
in interface org.refcodes.mixin.ResultAccessor<org.refcodes.web.RequestHeaderFields,RestResponseResult>
public void setQueryFields(org.refcodes.web.FormFields aQueryFields)
setQueryFields
in interface org.refcodes.web.QueryFieldsAccessor.QueryFieldsMutator
public org.refcodes.web.FormFields getQueryFields()
getQueryFields
in interface org.refcodes.web.QueryFieldsAccessor
public RestResponseResult withUrl(org.refcodes.web.Url aUrl)
withUrl
in interface org.refcodes.web.UrlAccessor.UrlBuilder
public RestResponseResult withHttpMethod(org.refcodes.web.HttpMethod aHttpMethod)
withHttpMethod
in interface org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestResponseResult>
public <REQ> RestResponseResult withRequest(REQ aRequest)
withRequest
in interface org.refcodes.web.HttpClientRequest.HttpClientRequestBuilder
public RestResponseResult withHeaderFields(org.refcodes.web.RequestHeaderFields aRequestHeaderFields)
withHeaderFields
in interface org.refcodes.web.HeaderFieldsAccessor.HeaderFieldsBuilder<org.refcodes.web.RequestHeaderFields,RestResponseResult>
public RestResponseResult withOpen() throws IOException
withOpen
in interface org.refcodes.component.Openable.OpenBuilder<org.refcodes.web.RequestHeaderFields>
IOException
public RestResponseResult withClose() throws IOException
withClose
in interface org.refcodes.component.Closable.CloseBuilder<org.refcodes.web.RequestHeaderFields>
IOException
public RestResponseResult withCloseQuietly()
withCloseQuietly
in interface org.refcodes.component.Closable.CloseBuilder<org.refcodes.web.RequestHeaderFields>
public RestResponseResult withCloseIn(int aCloseInMillis)
withCloseIn
in interface org.refcodes.component.Closable.CloseBuilder<org.refcodes.web.RequestHeaderFields>
public RestResponseResult build(RestClient aRestClient)
aRestClient
- the rest client to take care of the caller.public String toString()
toString
in class org.refcodes.web.HttpClientRequestImpl
public void onResponse(RestResponseEvent aResponse) throws org.refcodes.web.HttpResponseException
RestResponseEvent
describing the response being processed upon by your
lambda
's code. The method works synchronously and waits
(blocks the caller's thread) till it finishes execution.onResponse
in interface RestResponseConsumer
aResponse
- The response of type RestResponseEvent
describing the response context. Use
HttpClientResponseImpl.getResponse(Class)
to retrieve the
server's response body or
HttpResponseImpl.getHttpStatusCode()
to retrieve the
respone's HTTP Status-Code.org.refcodes.web.HttpResponseException
- thrown by a HTTP-Response handling system
in case of some unexpected response.Copyright © 2021. All rights reserved.