Page History
...
Include Page | ||||
---|---|---|---|---|
| ||||
Artifact maven dependencies snippet | ||||
rangeHigherVersion | 1.7 | |||
groupId | info.magnolia.restclient | artifactId | magnolia
Code Block |
---|
<dependency> <groupId>info.magnolia.restclient</groupId> <artifactId>magnolia-rest-client-app</artifactId> </dependency> |
app
Due to Maven transient dependencies, adding magnolia-rest-client-app
to your bundle automatically adds the magnolia-rest-client
and magnolia-resteasy-client
modules. Include Page
...
Artifact resource link | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Artifact resource link | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
.
...
...
Add all the submodules to your bundle.
...
magnolia-resteasy-client
: The easy-to-use Magnolia REST client implementation. It enables interface based service declaration. The module has a dependency to RESTEasy from JBoss.magnolia-rest-client-app
: Installs an app to test REST clients in the browser. You can test your clients in the app before using them in template scripts, models or other Java classes. See Testing clients in the REST client app.magnolia-rest-client
: Defines Defines the API for API for a Magnolia REST client definition class (to configure), for a REST client factory (to create instances) and for a registry (to obtain configured clients). It is an abstract layer which, besides the registry, you will hardly ever use directly. If If you have existing Java clients based on jersey or raw javax.ws.rs, you can implement a custom
customJavadoc resource link 0 info.magnolia.rest.client.factory.ClientFactory rangeHigherVersion 1.7 className info.magnolia.rest.client.factory.ClientFactory renderType asynchronous ClientFactory
to instantiate your existing custom clients the Magnolia way.
...
<rest client name> | required Add a node for each REST client. The name is arbitrary, but it is good practice to use a descriptive name. The node name is used when obtaining instances of clients. | ||||||||||||||||||||||||||||||||||
| required The base URL of the REST endpoint to connect with the client. | ||||||||||||||||||||||||||||||||||
| required The definition class, it must implement 0 | info.magnolia.rest.client.RestClientDefinition | rangeHigherVersion | 1.7 | className | info.magnolia.rest.client.RestClientDefinition renderType | asynchronous | Javadoc resource link | 0 | info.magnolia.resteasy.client.RestEasyClientDefinition | rangeHigherVersion | 1.7 | className | info.magnolia.resteasy.client.RestEasyClientDefinition renderType | asynchronous |
SSLRestEasyClientDefinition for secure connections or subclasses.If you rely on components or clientFilters, the definition class must extend 0 | info.magnolia.resteasy.client.RestEasyClientDefinition | rangeHigherVersion | 1.7 | className | info.magnolia.resteasy.client.RestEasyClientDefinition renderType | asynchronous | | ||||||||||||
| required The client factory class. Must implement 0 | info.magnolia.rest.client.factory.ClientFactory | rangeHigherVersion | 1.7 | className | info.magnolia.rest.client.factory.ClientFactory renderType | asynchronous | Javadoc resource link | 0 | info.magnolia.resteasy.client.factory.RestEasyClientFactory | rangeHigherVersion | 1.7 | className | info.magnolia.resteasy.client.factory.RestEasyClientFactory renderType | asynchronous |
SSLRestEasyClientFactory for secure connections or subclasses. | |||||||||||||||||||
| optional, default is Enables the underlying caching mechanism provided by RESTEasy. | ||||||||||||||||||||||||||||||||||
components | optional 1.0.8+ A list of components (e.g. | ||||||||||||||||||||||||||||||||||
| optional deprecated since 1.0.8, usecomponents instead A list of components (e.g. | ||||||||||||||||||||||||||||||||||
| optional A map of
ClientServiceDefinition objects. |
Note that ClientErrorInterceptor
is not supported.
...
Tip | |
---|---|
During installation of the | |
0 | info.magnolia.resteasy.client.setup.RestEasyClientModuleVersionHandler |
rangeHigherVersion | 1.7 | className | info.magnolia.resteasy.client.setup.
renderType | asynchronous |
...
Code Pro | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
- Add
AddJavadoc resource link 0 info.magnolia.rest.client.registry.RestClientRegistry rangeHigherVersion 1.7 className info.magnolia.rest.client.registry.RestClientRegistry renderType asynchronous RestClientRegistry
as parameter into the constructor and assign it as final instance variable (See lines 5, 7, 9.) - Obtain
ObtainJavadoc resource link 0 RestEasyClient rangeHigherVersion 1.7 className RestEasyClient renderType asynchronous RestEasyClient
object from the RestClientRegistry. Note that #getRestClient requires the configured name of the rest client definition. (See line 17.) - Create an instance of the declared interface
IcndbService
. (See line 18.) - Now call the declared method(s) on the service (line 23).
...