@Incubating
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface HttpBuilderClient
Marks an interface as a declarative HTTP client. An implementation class is generated at compile time via AST transform, using HttpBuilder for request execution.
Example:
@HttpBuilderClient('https://api.example.com') interface MyApi {@Get('/users/{id}') Map getUser(String id) } def api = MyApi.create() def user = api.getUser('123')
| Type | Name and Description |
|---|---|
boolean |
confineToBaseUriWhether requests are confined to the base URL. |
int |
connectTimeoutConnection timeout in seconds. |
boolean |
followRedirectsWhether to follow HTTP redirects. |
int |
requestTimeoutRequest timeout in seconds. |
Whether requests are confined to the base URL. When true, a
request whose resolved URI leaves the base URL's origin (scheme, host, or
effective port) or its path prefix is rejected with a
SecurityException. This covers a request template with an absolute
path or .. traversal, as well as an alternate base URL supplied to
the generated create(String) / create(Closure) factory that
points at a different host. Default is false.
Connection timeout in seconds. Default 0 means no timeout.
Whether to follow HTTP redirects. Default is false.
Request timeout in seconds. Default 0 means no timeout.
The base URL for all requests.