Package io.micronaut.http.client
Class AbstractHttpClientFactory<T extends HttpClient>
java.lang.Object
io.micronaut.http.client.AbstractHttpClientFactory<T>
- Type Parameters:
T
- The type ofHttpClient
created by this factory
- All Implemented Interfaces:
HttpClientFactory
- Direct Known Subclasses:
JdkHttpClientFactory
@Internal
public abstract class AbstractHttpClientFactory<T extends HttpClient>
extends Object
implements HttpClientFactory
Abstract class implementation of
HttpClientFactory
.- Since:
- 4.0.0
- Author:
- Sergio del Amo
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ConversionService
protected final MediaTypeCodecRegistry
protected final MessageBodyHandlerRegistry
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractHttpClientFactory
(@Nullable MediaTypeCodecRegistry mediaTypeCodecRegistry, MessageBodyHandlerRegistry messageBodyHandlerRegistry, ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescriptioncreateClient
(URL url) Create a newHttpClient
.createClient
(URL url, @NonNull HttpClientConfiguration configuration) Create a newHttpClient
with the specified configuration.protected abstract T
createHttpClient
(@Nullable URI uri) Creates a newHttpClient
instance for a given URI.protected abstract T
createHttpClient
(@Nullable URI uri, @NonNull HttpClientConfiguration configuration) Creates a newHttpClient
instance for a given URI and configuration.
-
Field Details
-
mediaTypeCodecRegistry
-
messageBodyHandlerRegistry
-
conversionService
-
-
Constructor Details
-
AbstractHttpClientFactory
protected AbstractHttpClientFactory(@Nullable @Nullable MediaTypeCodecRegistry mediaTypeCodecRegistry, MessageBodyHandlerRegistry messageBodyHandlerRegistry, ConversionService conversionService)
-
-
Method Details
-
createHttpClient
Creates a newHttpClient
instance for a given URI.- Parameters:
uri
- The URI- Returns:
- The client
-
createHttpClient
@NonNull protected abstract T createHttpClient(@Nullable @Nullable URI uri, @NonNull @NonNull HttpClientConfiguration configuration) Creates a newHttpClient
instance for a given URI and configuration.- Parameters:
uri
- The URIconfiguration
- The configuration- Returns:
- The client
-
createClient
Description copied from interface:HttpClientFactory
Create a newHttpClient
. Note that this method should only be used outside the context of an application. Within Micronaut useInject
to inject a client instead- Specified by:
createClient
in interfaceHttpClientFactory
- Parameters:
url
- The base URL- Returns:
- The client
-
createClient
@NonNull public @NonNull HttpClient createClient(URL url, @NonNull @NonNull HttpClientConfiguration configuration) Description copied from interface:HttpClientFactory
Create a newHttpClient
with the specified configuration. Note that this method should only be used outside the context of an application. Within Micronaut useInject
to inject a client instead- Specified by:
createClient
in interfaceHttpClientFactory
- Parameters:
url
- The base URLconfiguration
- the client configuration- Returns:
- The client
-