Class AbstractRestStub
- java.lang.Object
-
- de.aristaflow.ilm.ws.rest.base.service.AbstractStub
-
- de.aristaflow.ilm.ws.rest.base.service.AbstractRestStub
-
- Direct Known Subclasses:
ActivityStateNotificationRestStub
,ClientWorklistRestStub
,ExecutionMessageNotificationRestStub
,InstanceStateNotificationRestStub
,OrgPolicyScriptHandlerRestStub
public class AbstractRestStub extends AbstractStub
This class provides the means for making REST calls to callback objects. These objects are provided as URLs satisfying the corresponding callback interface. Subclasses of this class have to implement the callback interface defined as Java or ILM and forward the calls to the REST callback. Afterwards the responses of the callback have to be converted and returned to the caller of the callback (stub).
This also includes handling of expected exceptions (which belong to the interface) as well as various unexpected exceptions, especially ones caused by the REST framework.This stub implementation is rather simple and uses a plain
HttpURLConnection
and anObjectMapper
for converting to and from JSON.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AbstractRestStub.Request
ARequest
represents a request sent to the REST callback and also provides the return value sent via callback response.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractRestStub(URL baseUrl, String version, Supplier<com.fasterxml.jackson.databind.ObjectMapper> om, LogService logService)
Creates a new abstract stub providing the basic means for making REST callback calls.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractRestStub.Request
delete(String path)
Gets a#DELETE
request for the designated path (operation) at the callback.AbstractRestStub.Request
get(String path)
Gets a#GET
request for the designated path (operation) at the callback.AbstractRestStub.Request
post(String path)
Gets a#POST
request for the designated path (operation) at the callback.AbstractRestStub.Request
put(String path)
Gets a#PUT
request for the designated path (operation) at the callback.-
Methods inherited from class de.aristaflow.ilm.ws.rest.base.service.AbstractStub
getJsonFor
-
-
-
-
Constructor Detail
-
AbstractRestStub
protected AbstractRestStub(URL baseUrl, String version, Supplier<com.fasterxml.jackson.databind.ObjectMapper> om, LogService logService)
Creates a new abstract stub providing the basic means for making REST callback calls.- Parameters:
baseUrl
- The base URL of the callback.version
- The API version which to expect from the callback.om
- The object mapper (supplier) for reading JSON objects from responses (including exceptions).logService
- The log service for creating class-specific loggers.
-
-
Method Detail
-
get
public AbstractRestStub.Request get(String path)
Gets a#GET
request for the designated path (operation) at the callback.- Parameters:
path
- The path (operation) which to call.- Returns:
- A
#GET
request for the designated path (operation) at the callback.
-
post
public AbstractRestStub.Request post(String path)
Gets a#POST
request for the designated path (operation) at the callback.- Parameters:
path
- The path (operation) which to call.- Returns:
- A
#POST
request for the designated path (operation) at the callback.
-
delete
public AbstractRestStub.Request delete(String path)
Gets a#DELETE
request for the designated path (operation) at the callback.- Parameters:
path
- The path (operation) which to call.- Returns:
- A
#DELETE
request for the designated path (operation) at the callback.
-
put
public AbstractRestStub.Request put(String path)
Gets a#PUT
request for the designated path (operation) at the callback.- Parameters:
path
- The path (operation) which to call.- Returns:
- A
#PUT
request for the designated path (operation) at the callback.
-
-