{8.1.2-updated} @Remote

The {@link oaj.http.remote.Remote @Remote} annotation is used on your interface class to identify it as a REST proxy interface.

The @Remote annotation is optional, but often included for code readability.

@Remote(path)

The {@link oaj.http.remote.Remote#path @Remote(path)} annotation is used to define the HTTP path of the REST service.

The path can be an absolute path to your REST service.

Example:

@Remote(path="http://localhost:10000/petstore") public interface PetStore {...}

PetStore p = client.getRemote(PetStore.class);

When a relative path is specified, it's relative to the root-url defined on the RestClient used to instantiate the interface.

Example:

@Remote(path="/petstore") public interface PetStore {...}

RestClient client = RestClient.create().json().rootUrl("http://localhost:10000").build(); PetStore p = client.getRemote(PetStore.class);

When no path is specified, the root-url defined on the RestClient is used.

Example:

@Remote public interface PetStore {...}

RestClient client = RestClient.create().json().rootUrl("http://localhost:10000/petstore").build(); PetStore p = client.getRemote(PetStore.class);