{title:'@Remote', updated:'8.1.2,8.2.0', updated:'9.0.0'}

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

- {@link oaj.http.remote.Remote}
  - {@link oaj.http.remote.Remote#path path}
  - {@link oaj.http.remote.Remote#headers headers}
  - {@link oaj.http.remote.Remote#version version}
  - {@link oaj.http.remote.Remote#versionHeader versionHeader}

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 store = client.getRemote(PetStore. class);

VarResolver.DEFAULT can also be used in the path.

##### Example:

| // URL is specified via a system property. | @Remote(path="$S{PetStoreUrl}") | public interface PetStore {...}

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 store = 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 store = client.getRemote(PetStore. class);

##### @Remote(headers/headerList)

The {@link oaj.http.remote.Remote#headers @Remote(headers)} and {@link oaj.http.remote.Remote#headerList @Remote(headerList)} annotations are used to add headers on all requests.

##### Example:

| @Remote( | path="/petstore", | headers={ | "Foo: bar", | "Baz: $S{bazProperty}" | }, | headerList=MyHeaderList. class | ) | public interface PetStore {...}

| // Our dynamic supplier. | public class MyHeaderList extends HeaderList { | ... | }

##### @Remote(version/versionHeader)

The {@link oaj.http.remote.Remote#version @Remote(version)} and {@link oaj.http.remote.Remote#versionHeader @Remote(versionHeader)} annotations are used to specify the client-side version of this interface that can be used on the server side to perform version-specific handling.

##### Example:

| @Remote( | path="/petstore", | version="1.2.3" // Adds "Client-Version: 1.2.3" header to all requests. | ) | public interface PetStore {...}

This can be used in conjunction with the server-side client-versioning support.

| // Call this method if Client-Version is at least 2.0. | // Note that this also matches 2.0.1. | @RestGet(clientVersion="2.0") | public Object foo() {...} | | // Call this method if Client-Version is at least 1.1 but less than 2.0. | @RestGet(clientVersion="[1.1,2.0)") | public Object foo() {...} | | // Call this method if Client-Version is less than 1.1. | @RestGet(clientVersion="[0,1.1)") | public Object foo() {...}

- Client Versioning