This Addon requires the following installation steps.
To use this addon, you must add it as a dependency in the pom.xml of your forge-addon
classified artifact:
<dependency>
<groupId>org.jboss.forge.addon</groupId>
<artifactId>rest-client</artifactId>
<classifier>forge-addon</classifier>
<version>${version}</version>
</dependency>
- ClientFactory service for JAX-RS 2.0 Client creation
-
The ClientFactory provides a single API to create a javax.ws.rs.client.Client or a javax.ws.rs.client.ClientBuilder object.
@Inject private ClientFactory factory; ... Client client = factory.createClient(); String response = client.target("http://www.iheartquotes.com/api/v1/random").request(MediaType.TEXT_PLAIN_TYPE).get(String.class);
TipIf your addon uses a container that does not support "@Inject" annotations, services such as the
ClientFactory
may also be accessed via theAddonRegistry
:AddonRegistry registry = ... Imported<ClientFactory> imported = registry.getServices(ClientFactory.class); ClientFactory factory = imported.get();