Package org.refcodes.rest
Interface RestResponseObserver
-
- All Known Subinterfaces:
RestCaller
,RestCallerBuilder
- All Known Implementing Classes:
RestCallerBuilderImpl
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface RestResponseObserver
TheRestResponseObserver
can be coded using thelambda
syntax and processes a response from a server. TheRestResponseEvent
describes the context of the response e.g. retrieve the server's response viaHttpClientResponse.getResponse(Class)
or the response's HTTP Status-Code viaHttpStatusCodeAccessor.getHttpStatusCode()
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onResponse(RestResponseEvent aResponse)
The invoker provides a response context being aRestResponseEvent
describing the response being processed upon by yourlambda
's code.
-
-
-
Method Detail
-
onResponse
void onResponse(RestResponseEvent aResponse) throws org.refcodes.net.HttpResponseException
The invoker provides a response context being aRestResponseEvent
describing the response being processed upon by yourlambda
's code. The method works synchronously and waits (blocks the caller's thread) till it finishes execution.- Parameters:
aResponse
- The response of typeRestResponseEvent
describing the response context. UseHttpClientResponse.getResponse(Class)
to retrieve the server's response body orHttpStatusCodeAccessor.getHttpStatusCode()
to retrieve the respone's HTTP Status-Code.- Throws:
org.refcodes.net.HttpResponseException
- thrown by a HTTP-Response handling system in case of some unexpected response.
-
-