
net.winterly.rxjersey.client.inject.Remote Maven / Gradle / Ivy
package net.winterly.rxjersey.client.inject;
import org.glassfish.hk2.api.InjectionResolver;
import org.glassfish.hk2.api.TypeLiteral;
import javax.inject.Qualifier;
import javax.ws.rs.core.UriInfo;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Injection qualifier for Proxy Client or {@link javax.ws.rs.client.WebTarget}.
* If annotation value contains host then value will be used as target URI for {@link javax.ws.rs.client.WebTarget}
* otherwise value will be merged with {@link UriInfo#getBaseUri()}.
* Annotation value has higher priority in merge
* Example:
*
* value="http://example.com", baseUrl="http://baseurl.com/resource" will produce "http://example.com/"
* value="/resource", baseUrl="http://baseurl.com/some" will produce "http://baseurl.com/resource"
*
* Usage:
*
* @Remote("http://example.com/")
* ResourceInterface resource;
*
*
* @Remote
* ResourceInterface resource;
*
*
* @see RemoteResolver
*/
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Remote {
TypeLiteral TYPE = new TypeLiteral>() { };
String value() default "/";
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy