Annotation Interface Remote
See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionInterface-level defaultAcceptheader (and response parser fallback) for all methods.booleanOpts this interface's absolute@Remote/@Url/baseUrl()targets out of the default deny-private SSRF guardrail, applied to every method on the proxy.Base/host override applied to every request the proxy makes.Interface-level default request body format (andContent-Typeheader) for all methods.String[]Default request form-data parameters.Class<?>Default request header list.String[]Default request headers.Class<?>[]Default lifecycle interceptors applied to every request the proxy makes.REST service path.String[]Default request query parameters.intDefault maximum number of automatic retry attempts applied to every request the proxy makes.booleanOpts non-idempotent verbs (POST /PATCH ) into automatic retries for every method on the proxy.booleanDefault for throwing a generic exception on an error response, applied to every method on the proxy.Default per-call response/read timeout applied to every request the proxy makes.Alias forpath().Specifies the client version of this interface.Specifies the client version header name.
-
Element Details
-
headerList
Class<?> headerListDefault request header list.Specifies a supplier of headers to set on all requests. The value is interpreted by the active REST client: the classic Apache-HttpClient transport accepts subclasses of
org.apache.juneau.http.classic.header.HeaderList ; other transports may ignore the value.Notes:
- Supplier class must provide a public no-arg constructor.
-
Default
Void.class means no default header list is supplied.
- Returns:
- The annotation value.
- Default:
- java.lang.Void.class
-
headers
Default request headers.Specifies headers to set on all requests.
Notes:
-
Supports VarResolver.DEFAULT
(e.g.
"$P{mySystemProperty}" ).
- Returns:
- The annotation value.
- Default:
- {}
-
Supports VarResolver.DEFAULT
(e.g.
-
queryData
Default request query parameters.Specifies always-applied constant query parameters emitted on every request the proxy makes — no corresponding method parameter is required. Each entry uses the
"name=value" form (the first'=' separates name from value), mirroring the URL-query convention and theheaders()"Name: value" precedent.A caller-supplied parameter value for the same name still composes with the constant (the constant is not suppressed). A method-level constant of the same name (see
@RemoteOp(queryData=...)and the verb annotations) takes precedence over the interface-level value declared here.Notes:
-
Supports VarResolver.DEFAULT
(e.g.
"$S{mySystemProperty}" ). -
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ).
- Returns:
- The annotation value.
- Default:
- {}
-
Supports VarResolver.DEFAULT
(e.g.
-
formData
Default request form-data parameters.Specifies always-applied constant form-data fields emitted on every request the proxy makes — no corresponding method parameter is required. Each entry uses the
"name=value" form (the first'=' separates name from value), mirroring the form-encoded convention and theheaders()"Name: value" precedent.A caller-supplied parameter value for the same name still composes with the constant (the constant is not suppressed). A method-level constant of the same name (see
@RemoteOp(formData=...)and the verb annotations) takes precedence over the interface-level value declared here.Notes:
-
Supports VarResolver.DEFAULT
(e.g.
"$S{mySystemProperty}" ). -
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ).
- Returns:
- The annotation value.
- Default:
- {}
-
Supports VarResolver.DEFAULT
(e.g.
-
path
REST service path.- An absolute URL.
- A relative URL interpreted as relative to the root URL defined on the
RestClient - No path interpreted as the class name (e.g.
"http://localhost/root-url/org.foo.MyInterface" )
Notes:
-
Supports VarResolver.DEFAULT
(e.g.
"$P{mySystemProperty}" ).
- Returns:
- The annotation value.
- Default:
- ""
-
value
Alias forpath().Supports VarResolver.DEFAULT (e.g.
"$P{mySystemProperty}" ).- Returns:
- The annotation value.
- Default:
- ""
-
baseUrl
Base/host override applied to every request the proxy makes.Replaces only the authority+root portion of the request URL — in effect, an annotation-declared substitute for the client's root URL — while preserving the interface base path, the method path, and any
{var} templating. For example, withbaseUrl= , an interface path of"http://other-host" "/api" and a method path of"/users/{id}" , the effective URL is"http://other-host/api/users/{id}" .Precedence (most-specific first): an
@Urlparameter, then a method-levelbaseUrl(see@RemoteOp(baseUrl=...)and the verb annotations), then this interface-level value, then the client root URL.Notes:
-
Supports VarResolver.DEFAULT
(e.g.
"$S{mySystemProperty}" ). -
Only
http /https schemes are permitted when the override yields an absolute URL; other schemes are rejected (SSRF guardrail). -
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ), with the same http/https-only scheme guard on both.
- Returns:
- The annotation value.
- Default:
- ""
-
Supports VarResolver.DEFAULT
(e.g.
-
contentType
Interface-level default request body format (andContent-Typeheader) for all methods.Names a media type (e.g.
"application/xml" ) used as the default for every method on this interface. The next-generation engine selects the matching registered request serializer from the client's serializer set so the request body bytes are actually written in that format, and sets theContent-Typeheader to this media type — cleanly replacing the serializer's default content type (exactly oneContent-Typeheader is sent). If no registered serializer matches, the client's default serializer is used but this media type is still sent as the label (supporting vendor media types).A method-level
RemoteOp.contentType()(or verb-annotation equivalent) overrides this default.Notes:
-
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ).
- Returns:
- The annotation value.
- Default:
- ""
-
Honored by both the next-generation engine (
-
accept
Interface-level defaultAcceptheader (and response parser fallback) for all methods.Names a media type (e.g.
"application/xml" ) sent as the defaultAcceptheader for every method on this interface. Response parsing remains driven by the responseContent-Type; this media type is the fallback parser only when the response is unlabeled or itsContent-Typematches no registered parser.A method-level
RemoteOp.accept()(or verb-annotation equivalent) overrides this default.Notes:
-
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ).
- Returns:
- The annotation value.
- Default:
- ""
-
Honored by both the next-generation engine (
-
version
Specifies the client version of this interface.Used to populate the
"Client-Version" header that identifies what version of client this is so that the server side can handle older versions accordingly.The format of this is a string of the format
#[.#[.#[...]] (e.g."1.2.3" ).The server side then uses an OSGi-version matching pattern to identify which methods to call:
// Call this method if Client-Version is at least 2.0. // Note that this also matches 2.0.1. @RestGet (path="/foobar" , clientVersion="2.0" )public Object method1() {...}// Call this method if Client-Version is at least 1.1, but less than 2.0. @RestGet (path="/foobar" , clientVersion="[1.1,2.0)" )public Object method2() {...}// Call this method if Client-Version is less than 1.1. @RestGet (path="/foobar" , clientVersion="[0,1.1)" )public Object method3() {...}Notes:
-
Supports VarResolver.DEFAULT
(e.g.
"$P{mySystemProperty}" ).
- Returns:
- The annotation value.
- Default:
- ""
-
Supports VarResolver.DEFAULT
(e.g.
-
versionHeader
Specifies the client version header name.The default value is
"Client-Version" .Notes:
-
Supports VarResolver.DEFAULT
(e.g.
"$P{mySystemProperty}" ).
- Returns:
- The annotation value.
- Default:
- ""
-
Supports VarResolver.DEFAULT
(e.g.
-
interceptors
Class<?>[] interceptorsDefault lifecycle interceptors applied to every request the proxy makes.Each class must implement the next-generation
RestCallInterceptor SPI and provide a public no-arg constructor. Interface-level interceptors run after the builder-configured interceptors and before any method-level (@RemoteOp/@RemoteGet/...(interceptors=...)) interceptors; the three sets are unioned in the order builder → interface → method (method-level runs closest to the call).Notes:
-
The member type is
Class<?>[](notClass<? extends RestCallInterceptor>[]) becauseRestCallInterceptor lives in thejuneau-rest-clientmodule, which this annotation's module must not depend on; each element is resolved to aRestCallInterceptor at proxy-build time. -
Honored by the next-generation engine (
RestClient.remote(...) ) only; the classic engine currently ignores this attribute.
- Returns:
- The annotation value.
- Default:
- {}
-
The member type is
-
timeout
Default per-call response/read timeout applied to every request the proxy makes.Expressed as a duration string (e.g.
"30s" ,"1500ms" ,"1m" ) parsed by Juneau's duration parser. A method-leveltimeout(@RemoteOp/@RemoteGet/...) overrides this default. Connect timeouts remain a client-level setting (not configurable per call).Notes:
-
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ).
- Returns:
- The annotation value.
- Default:
- ""
-
Honored by both the next-generation engine (
-
retries
int retriesDefault maximum number of automatic retry attempts applied to every request the proxy makes.A value of
0(the default) disables retries. A positive method-levelretriesoverrides this default. See@RemoteOp(retries=...)for the retry trigger statuses and the (hard) safety gating rules.Notes:
-
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ).
- Returns:
- The annotation value.
- Default:
- 0
-
Honored by both the next-generation engine (
-
retryNonIdempotent
boolean retryNonIdempotentOpts non-idempotent verbs (POST /PATCH ) into automatic retries for every method on the proxy.Has no effect unless
retries()(or a method-levelretries) is positive. Even when enabled, a request with a non-repeatable body is never retried. The effective value is the logical OR of this default and the method-level value.Notes:
-
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ).
- Returns:
- The annotation value.
- Default:
- false
-
Honored by both the next-generation engine (
-
throwOnError
boolean throwOnErrorDefault for throwing a generic exception on an error response, applied to every method on the proxy.When
true and the response status is an error (>=400) and no typed exception from the method'sthrowsclause matched, a generic exception is thrown. The effective value is the logical OR of this default and the method-level value. See@RemoteOp(throwOnError=...).Notes:
-
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ).
- Returns:
- The annotation value.
- Default:
- false
-
Honored by both the next-generation engine (
-
allowPrivateUrls
boolean allowPrivateUrlsOpts this interface's absolute@Remote/@Url/baseUrl()targets out of the default deny-private SSRF guardrail, applied to every method on the proxy.By default, an absolute
http /https URL supplied viabaseUrl(), an@Urlparameter, or an already-absolutepath()/value()is rejected — both at pre-check time and at connect time via resolved-address pinning, re-checked on every followed redirect — when it targets a loopback, RFC1918/link-local, IPv6 unique-local, or cloud-metadata address. Setting this totrue disables that check for local-dev/intranet targets that are intentionally private.The effective value is the logical OR of this annotation value, the
RestClientbuilder'sallowPrivateUrls(...)setting, and the"RestClient.allowPrivateUrls" system property: any one of the three opting in is sufficient.Notes:
-
Honored by both the next-generation engine (
RestClient.remote(...) ) and the classic engine (RestClient.getRemote(...) ). - Does not affect the http/https-only scheme guard, which always applies.
- Returns:
- The annotation value.
- Default:
- false
-
Honored by both the next-generation engine (
-