public class RestCallerBuilderImpl extends org.refcodes.net.HttpClientRequestImpl implements RestCallerBuilder
RestCallerBuilder
interface as good old
POJO for use by different RestClient
implementations.org.refcodes.net.UrlAccessor.UrlBuilder, org.refcodes.net.UrlAccessor.UrlMutator, org.refcodes.net.UrlAccessor.UrlProperty
org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.net.HttpMethodAccessor.HttpMethodMutator, org.refcodes.net.HttpMethodAccessor.HttpMethodProperty
org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsBuilder<T extends org.refcodes.net.HeaderFields<?,?>,B extends org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsBuilder<T,B>>, org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsMutator<T extends org.refcodes.net.HeaderFields<?,?>>, org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsProperty<T extends org.refcodes.net.HeaderFields<?,?>>
org.refcodes.net.QueryFieldsAccessor.QueryFieldsBuilder<B extends org.refcodes.net.QueryFieldsAccessor.QueryFieldsBuilder<?>>, org.refcodes.net.QueryFieldsAccessor.QueryFieldsMutator, org.refcodes.net.QueryFieldsAccessor.QueryFieldsProperty
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>>
Constructor and Description |
---|
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
org.refcodes.net.Url aUrl,
Object aRequest,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new rest caller builder impl.
|
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
org.refcodes.net.Url aUrl,
org.refcodes.net.RequestHeaderFields aHeaderFields,
Object aRequest,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new rest caller builder impl.
|
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
org.refcodes.net.Url aUrl,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
Instantiates a new rest caller builder impl.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
org.refcodes.component.ConnectionStatus |
getConnectionStatus() |
org.refcodes.net.HttpMethod |
getHttpMethod() |
RestResponseObserver |
getResponseObserver()
Retrieves the
RestResponseObserver to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method. |
org.refcodes.net.Url |
getUrl() |
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.net.RequestHeaderFields aHeaderFields) |
void |
setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod) |
void |
setResponseObserver(RestResponseObserver aLambda)
Sets the
RestResponseObserver to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method. |
void |
setUrl(org.refcodes.net.Url aUrl) |
String |
toString() |
getRequest, setRequest, toHttpBody
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getQueryFields, setQueryFields, withClose, withCloseIn, withCloseQuietly, withHeaderFields, withHttpMethod, withOpen, withRequest, withResponseObserver, withUrl
getRequest, setRequest, toHttpBody
withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToHeaderFields, withAddToQueryFields, withAddToQueryFields, withAddToQueryFields
public RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, org.refcodes.net.RequestHeaderFields aHeaderFields, Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
aHttpMethod
- the a http methodaUrl
- The Url
from which to take the URL specific data.aHeaderFields
- the a Header-FieldsaRequest
- the a requestaResponseObserver
- the a response observeraMediaTypeFactoryLookup
- the a media type factory lookuppublic RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
aHttpMethod
- the a http methodaUrl
- The Url
from which to take the URL specific data.aResponseObserver
- the a response observeraMediaTypeFactoryLookup
- the a media type factory lookuppublic RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, org.refcodes.net.Url aUrl, Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
aHttpMethod
- the a http methodaUrl
- The Url
from which to take the URL specific data.aRequest
- the a requestaResponseObserver
- the a response observeraMediaTypeFactoryLookup
- the a media type factory lookuppublic void onResponse(RestResponseEvent aResponse) throws org.refcodes.net.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 RestResponseObserver
aResponse
- The response of type RestResponseEvent
describing the response context. Use
HttpClientResponse.getResponse(Class)
to retrieve the
server's response body or
HttpStatusCodeAccessor.getHttpStatusCode()
to retrieve the
respone's HTTP Status-Code.org.refcodes.net.HttpResponseException
- thrown by a HTTP-Response handling system
in case of some unexpected response.public org.refcodes.net.HttpMethod getHttpMethod()
getHttpMethod
in interface org.refcodes.net.HttpMethodAccessor
getHttpMethod
in class org.refcodes.net.HttpRequestImpl
public void setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod)
setHttpMethod
in interface org.refcodes.net.HttpMethodAccessor.HttpMethodMutator
public RestResponseObserver getResponseObserver()
RestResponseObserver
to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method.getResponseObserver
in interface RestCallerBuilder
RestResponseObserver
to handle
responses.public void setResponseObserver(RestResponseObserver aLambda)
RestResponseObserver
to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method.setResponseObserver
in interface RestCallerBuilder
aLambda
- The (user defined) RestResponseObserver
to handle
responses, feel free to code it as lambda
expression!public void open() throws org.refcodes.component.OpenException
open
in interface org.refcodes.component.Openable
org.refcodes.component.OpenException
public void close() throws org.refcodes.component.CloseException
close
in interface org.refcodes.component.Closable
org.refcodes.component.CloseException
public org.refcodes.component.ConnectionStatus getConnectionStatus()
getConnectionStatus
in interface org.refcodes.component.ConnectionStatusAccessor
public void setHeaderFields(org.refcodes.net.RequestHeaderFields aHeaderFields)
setHeaderFields
in interface org.refcodes.net.HeaderFieldsAccessor.HeaderFieldsMutator<org.refcodes.net.RequestHeaderFields>
public org.refcodes.net.Url getUrl()
getUrl
in interface org.refcodes.net.UrlAccessor
getUrl
in class org.refcodes.net.HttpRequestImpl
public void setUrl(org.refcodes.net.Url aUrl)
setUrl
in interface org.refcodes.net.UrlAccessor.UrlMutator
Copyright © 2018. All rights reserved.