Annotation Interface Client
HttpClient
implementations.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The interface definition type. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe protocols to support for TLS ALPN.Class<? extends HttpClientConfiguration>
The interface definition type.Class<?>
Deprecated.There are now separate settings for HTTP and HTTPS connections.The base URI for the client.The connection mode to use for plaintext (http as opposed to https) connections.
-
Element Details
-
value
- Returns:
- The URL or service ID of the remote service
- Default:
- ""
-
id
- Returns:
- The ID of the client
- Default:
- ""
-
definitionType
The interface definition type. When set toDefinitionType.SERVER
theProduces
andConsumes
definition evaluated for each method of the interface will be reversed .Whilst not necessarily recommended, there are scenarios like testing where it is useful to share a common interface between client and server and use the interface to create a new client declarative client. The client typically needs to produce the content type accepted by the server and consume the content type produced by the server. In this arrangement using the interface directly will not result in the correct behaviour.
In this scenario you can set
Client.DefinitionType
toDefinitionType.SERVER
which will ensure the requests sent by the client use the content type declared by theConsumes
annotation of the interface and that responses use the content type declared by theProduces
.The default behaviour is to use
DefinitionType.CLIENT
where the inverse of the above is true.- Default:
- CLIENT
-
path
String pathThe base URI for the client. Only to be used in conjunction withid()
.- Returns:
- The base URI
- Default:
- ""
-
errorType
Class<?> errorType- Returns:
- The type used to decode errors
- Default:
- io.micronaut.http.hateoas.JsonError.class
-
configuration
Class<? extends HttpClientConfiguration> configuration- Returns:
- The http client configuration bean to use
- Default:
- io.micronaut.http.client.HttpClientConfiguration.class
-
httpVersion
Deprecated.There are now separate settings for HTTP and HTTPS connections. To configure HTTP connections (e.g. for h2c), useplaintextMode()
. To configure ALPN, setalpnModes()
.The HTTP version.- Returns:
- The HTTP version of the client.
- Default:
- HTTP_1_1
-
plaintextMode
The connection mode to use for plaintext (http as opposed to https) connections.
Note: IfhttpVersion()
is set, this setting is ignored!- Returns:
- The plaintext connection mode.
- Since:
- 4.0.0
- Default:
- HTTP_1
-
alpnModes
The protocols to support for TLS ALPN. If HTTP 2 is included, this will also restrict the TLS cipher suites to those supported by the HTTP 2 standard.
Note: IfhttpVersion()
is set, this setting is ignored!- Returns:
- The supported ALPN protocols.
- Since:
- 4.0.0
- Default:
- {"h2", "http/1.1"}
-