Rest DataDescriptor
Rest DataDescriptors allow you to manage the data served by the Rest webservers. These data descriptors use custom Rest server endpoints, Rest parameters (media type, base path, etc) and handlers to build requests and process the responses, so it has native data access. Native data access also means that there are no entity classes for the data descriptor. When creating a data descriptor, you have to specify the Rest parameters for a given connection. If you don't specify these parameters then the operation cannot be used with the data descriptor.
Available parameters:
Parameter name | Meaning |
---|---|
endpoint | Rest service endpont (e.g: http://www.omdbapi.com ) - required |
basePath | Base path. Added to the endpoint (e.g: /api) |
mediaType | Message format. (e.g: application/json, this is the default if the parameter missing) |
timeout | Specifies the time until the connection is established in milliseconds. Default: 10000 ms |
filterHandler | Custom handler class name that builds filter functionality for request |
paginationHandler | Custom handler class name that builds pagination functionality for request |
orderHandler | Custom handler class name that builds order functionality for request |
responseHandler | Custom handler class name that processes the response |
save.path | Path for save function, e.g: /phone |
find.path | Path for find function, e.g: /phone/find |
find.limitParamName | Url param name for max record count, default: size |
find.pageParamName | Url param name for pagination, default: page |
find.filterParamName | Url param name for filtering, default: filter |
find.sortParamName | Url param name for sorting, default: sort |
findById.path | Path for findById function, e.g: /phone/find/{id} |
rowCount.path | Path for rowCount function, e.g: /phone/count |
rowCount.filterParamName | Url param name for filtering, default: filter |
delete.path | Path for delete function, e.g: /phone/delete |
delete.filterParamName | Url param name for filtering, default: filter |
deleteById.path | Path for deleteById function, e.g: /phone/delete/{id} |
proxyHost | Proxy host |
proxyPort | Proxy port |
sslAcceptAll | Configure the HTTP client to trust all certificate chains regardless of their validity |
sslClientCertPath | Client side certificate |
authType | Authentication type, default: BASIC |
authUserName | User name |
authPassword | Password |
Specifying the filterHandler, paginationHandler, orderHandler allows you to build your own GET parameters dynamically, before the Rest call.
For example, if the Rest service requires it, the filter parameters can be passed like this:
Then the "?filter=What+do+you+want+to+filter" filter parameter can be built in the parameters of the fileHandler class.
To process the response, use the reponseHandler class. This can be skipped, if the response does not come back as a JSON array.
When implementing handlers, the related interfaces must be implemented as well (by implementing their handle() method). These interfaces are the following:
Interface name | Usage |
---|---|
JBFilterHandler | Interface for FilterHandler |
JBOrderHandler | Interface for OrderHandler |
JBPaginationHandler | Interface for PaginationHandler |
JBResponseHandler | Interface for ResponseHandler |