public class RestCallerBuilderImpl extends org.refcodes.net.impls.HttpClientRequestImpl implements RestCallerBuilder
RestCallerBuilder
interface as good old
POJO for use by different RestClient
implementations.org.refcodes.mixin.LocatorAccessor.LocatorBuilder<T,B extends org.refcodes.mixin.LocatorAccessor.LocatorBuilder<T,B>>, org.refcodes.mixin.LocatorAccessor.LocatorMutator<T>, org.refcodes.mixin.LocatorAccessor.LocatorProperty<T>
org.refcodes.net.QueryFieldsAccessor.QueryFieldsBuilder<B extends org.refcodes.net.QueryFieldsAccessor.QueryFieldsBuilder<?>>, org.refcodes.net.QueryFieldsAccessor.QueryFieldsMutator, org.refcodes.net.QueryFieldsAccessor.QueryFieldsProperty
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.component.LinkComponent.LinkAutomaton
org.refcodes.component.Openable.OpenAutomaton
Constructor and Description |
---|
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
org.refcodes.net.FormFields aQueryFields,
Object aRequest,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
org.refcodes.net.FormFields aQueryFields,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
Object aRequest,
RestResponseObserver aResponseObserver,
org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
org.refcodes.component.ConnectionStatus |
getConnectionStatus() |
org.refcodes.net.HttpMethod |
getHttpMethod() |
String |
getLocator() |
RestResponseObserver |
getResponseObserver()
Retrieves the
RestResponseObserver to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method. |
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 |
setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod) |
void |
setLocator(String aLocator) |
void |
setQueryFields(org.refcodes.net.FormFields aQueryFields) |
void |
setResponseObserver(RestResponseObserver aLambda)
Sets the
RestResponseObserver to which any responses are
delegated upon invocation of the RestResponseObserver.onResponse(RestResponseEvent)
method. |
getRequest, setRequest, toHttpBody
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
withHttpMethod, withLocator, withQueryFields, withRequest, withRequestObserver
public RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, String aLocator, org.refcodes.net.FormFields aQueryFields, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
public RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, String aLocator, Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
public RestCallerBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, String aLocator, org.refcodes.net.FormFields aQueryFields, Object aRequest, RestResponseObserver aResponseObserver, org.refcodes.net.MediaTypeFactoryLookup aMediaTypeFactoryLookup)
public void onResponse(RestResponseEvent aResponse) throws org.refcodes.net.HttpResponseException
RestResponseObserver
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 String getLocator()
getLocator
in interface org.refcodes.mixin.LocatorAccessor<String>
getLocator
in class org.refcodes.net.impls.HttpRequestImpl
public org.refcodes.net.HttpMethod getHttpMethod()
getHttpMethod
in interface org.refcodes.net.HttpMethodAccessor
getHttpMethod
in class org.refcodes.net.impls.HttpRequestImpl
public void setLocator(String aLocator)
setLocator
in interface org.refcodes.mixin.LocatorAccessor.LocatorMutator<String>
public void setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod)
setHttpMethod
in interface org.refcodes.net.HttpMethodAccessor.HttpMethodMutator
public RestResponseObserver getResponseObserver()
RestCallerBuilder
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)
RestCallerBuilder
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 setQueryFields(org.refcodes.net.FormFields aQueryFields)
setQueryFields
in interface org.refcodes.net.QueryFieldsAccessor.QueryFieldsMutator
Copyright © 2017. All rights reserved.