Package io.micronaut.http.client.jdk
Class JdkHttpClientFactory
java.lang.Object
io.micronaut.http.client.AbstractHttpClientFactory<DefaultJdkHttpClient>
io.micronaut.http.client.jdk.JdkHttpClientFactory
- All Implemented Interfaces:
HttpClientFactory
,RawHttpClientFactory
@Internal
public class JdkHttpClientFactory
extends AbstractHttpClientFactory<DefaultJdkHttpClient>
implements RawHttpClientFactory
Factory to create java.net.http.* HTTP Clients.
- Since:
- 4.0.0
- Author:
- Sergio del Amo
-
Field Summary
Fields inherited from class io.micronaut.http.client.AbstractHttpClientFactory
conversionService, mediaTypeCodecRegistry, messageBodyHandlerRegistry
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MessageBodyHandlerRegistry
protected DefaultJdkHttpClient
createHttpClient
(URI uri) Creates a newHttpClient
instance for a given URI.protected DefaultJdkHttpClient
createHttpClient
(URI uri, HttpClientConfiguration configuration) Creates a newHttpClient
instance for a given URI and configuration.createRawClient
(@Nullable URI url, @NonNull HttpClientConfiguration configuration) Create a newRawHttpClient
with the specified configuration.Methods inherited from class io.micronaut.http.client.AbstractHttpClientFactory
createClient, createClient
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.client.RawHttpClientFactory
createRawClient
-
Constructor Details
-
JdkHttpClientFactory
public JdkHttpClientFactory()
-
-
Method Details
-
createHttpClient
Description copied from class:AbstractHttpClientFactory
Creates a newHttpClient
instance for a given URI.- Specified by:
createHttpClient
in classAbstractHttpClientFactory<DefaultJdkHttpClient>
- Parameters:
uri
- The URI- Returns:
- The client
-
createHttpClient
Description copied from class:AbstractHttpClientFactory
Creates a newHttpClient
instance for a given URI and configuration.- Specified by:
createHttpClient
in classAbstractHttpClientFactory<DefaultJdkHttpClient>
- Parameters:
uri
- The URIconfiguration
- The configuration- Returns:
- The client
-
createDefaultMessageBodyHandlerRegistry
-
createRawClient
@NonNull public @NonNull RawHttpClient createRawClient(@Nullable @Nullable URI url, @NonNull @NonNull HttpClientConfiguration configuration) Description copied from interface:RawHttpClientFactory
Create a newRawHttpClient
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:
createRawClient
in interfaceRawHttpClientFactory
- Parameters:
url
- The base URLconfiguration
- the client configuration- Returns:
- The client
-