org.glassfish.jersey.server

## Annotation Type Uri

    @Target(value={PARAMETER,FIELD,METHOD})
     @Retention(value=RUNTIME)
     @Documented
    public @interface Uri

Injects a `resource target` pointing at a resource identified by the resolved URI into a method parameter, class field or a bean property.

Injected variable must be of type `jakarta.ws.rs.client.WebTarget`.

Since:
  2.0
Author:
  Marek Potociar
See Also:
  `jakarta.ws.rs.client.WebTarget`

### Required Element Summary

Required Elements
`String` `value` Specifies the URI of the injected `resource target`.

### Element Detail

#### value

    public abstract String value

Specifies the URI of the injected `resource target`. The value must be in the form of absolute URI if not used from inside of a JAX-RS component class. For example:

     public class AuditingFilter implements RequestFilter {
        @Uri("users/{name}/orders")
        WebTarget userOrders;

        // An external resource target
        @Uri("http://mail.acme.com/accounts/{name}")
        WebTarget userEmailAccount;

        // An external, template-based resource target
        @Uri("http://{audit-host}:{audit-port}/auditlogs/")
        WebTarget auditLogs;
        ...
     }

If used from within a JAX-RS component class (e.g. resource, filter, provider … ), the value can take a form of absolute or relative URI. A relative URI is resolved using the context path of the application as the base URI. For example:

     public class AuditingFilter implements RequestFilter {
        @Uri("audit/logs")
        WebTarget applicationLogs;

        @Uri("http://sales.acme.com/audit/logs")
        WebTarget domainLogs;

        ...
     }

In case the annotation is used from a JAX-RS resource class, an absolute or relative URI template value may be provided. The template parameter (e.g. `{id}`) values are automatically resolved in the context of the enclosing resource class `path template` as well as the context of the processed request. Other defined template parameters have to be resolved before invocation of managed web target. For example:

     @Path("users/{name}")
     public class MyResource {
        @Uri("users/{name}/orders")
        WebTarget userOrders;

        @Uri("http://mail.acme.com/accounts/{name}")
        WebTarget userEmailAccount;

        ...
     }

See Also:
  `jakarta.ws.rs.client.WebTarget`, `Path`