Orbit REST Client


License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

cloud.orbit
ArtifactId

ArtifactId

orbit-rest-client
Last Version

Last Version

0.8.2
Release Date

Release Date

Type

Type

jar
Description

Description

Orbit REST Client
Orbit REST Client
Project Organization

Project Organization

Electronic Arts Inc
Source Code Management

Source Code Management

https://github.com/orbit/orbit-rest-client

Download orbit-rest-client

How to add to project

<!-- https://jarcasting.com/artifacts/cloud.orbit/orbit-rest-client/ -->
<dependency>
    <groupId>cloud.orbit</groupId>
    <artifactId>orbit-rest-client</artifactId>
    <version>0.8.2</version>
</dependency>
// https://jarcasting.com/artifacts/cloud.orbit/orbit-rest-client/
implementation 'cloud.orbit:orbit-rest-client:0.8.2'
// https://jarcasting.com/artifacts/cloud.orbit/orbit-rest-client/
implementation ("cloud.orbit:orbit-rest-client:0.8.2")
'cloud.orbit:orbit-rest-client:jar:0.8.2'
<dependency org="cloud.orbit" name="orbit-rest-client" rev="0.8.2">
  <artifact name="orbit-rest-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='cloud.orbit', module='orbit-rest-client', version='0.8.2')
)
libraryDependencies += "cloud.orbit" % "orbit-rest-client" % "0.8.2"
[cloud.orbit/orbit-rest-client "0.8.2"]

Dependencies

compile (1)

Group / Artifact Type Version
javax.ws.rs : javax.ws.rs-api jar 2.0.1

test (7)

Group / Artifact Type Version
org.glassfish.jersey.core : jersey-client jar 2.22.2
org.glassfish.jersey.ext : jersey-proxy-client jar 2.22.2
cloud.orbit : orbit-commons jar 0.9.0
cloud.orbit : orbit-jetty jar 0.8.2
org.slf4j : slf4j-simple jar 1.7.21
junit : junit jar 4.12
com.ea.agentloader : ea-agent-loader jar 1.0.0

Project Modules

There are no modules declared in this project.

Orbit Async REST Client

Release Maven Central Javadocs Build Status Gitter

Allows calling JAX-RS REST interfaces with methods returning CompletableFuture or Orbit Task. This enables writing REST client code in a fluent asynchronous way.

The project orbit-rest-client depends only on the JAX-RS standard and it is in principle compatible with any client library that provides javax.ws.rs.client.WebTarget. It has been tested with jersey-client.

Developer & License

This project was developed by Electronic Arts and is licensed under the BSD 3-Clause License.

Examples

Using Orbit Tasks

public interface Hello
{
    @GET
    @Path("/")
    Task<String> getHome();
}

public static void main(String args[])
{
    WebTarget webTarget = getWebTarget("http://example.com");

    Hello hello = new RestClient(webTarget).get(Hello.class);

    Task<String> response = hello.getHome();

    response.thenAccept(x -> System.out.println(x)); 
    response.join();
}

// use any jax-rs client library to get javax.ws.rs.client.WebTarget
private static WebTarget getWebTarget(String host)
{
    ClientConfig clientConfig = new ClientConfig();
    Client client = ClientBuilder.newClient(clientConfig);
    return client.target(host);
}

Using CompletableFuture

public interface Hello
{
    @GET
    @Path("/")
    CompletableFuture<String> getHome();
}

public static void main(String args[])
{
    WebTarget webTarget = getWebTarget("http://example.com");

    Hello hello = new RestClient(webTarget).get(Hello.class);

    CompletableFuture<String> response = hello.getHome();
    
    response.thenAccept(x -> System.out.println(x)); 
    response.join();
}

// use any jax-rs client library to get javax.ws.rs.client.WebTarget
private static WebTarget getWebTarget(String host)
{
    ClientConfig clientConfig = new ClientConfig();
    Client client = ClientBuilder.newClient(clientConfig);
    return client.target(host);
}
cloud.orbit

Orbit

Distributed systems framework for the JVM by @ElectronicArts.

Versions

Version
0.8.2
0.8.1
0.8.0