Package io.micronaut.http.client
Interface ProxyHttpClient
- All Known Implementing Classes:
DefaultHttpClient
public interface ProxyHttpClient
Interface that allows proxying of HTTP requests in controllers and filters.
- Since:
- 2.0.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProxyHttpClient
Create a newProxyHttpClient
.static ProxyHttpClient
create
(@Nullable URL url, @NonNull HttpClientConfiguration configuration) Create a newProxyHttpClient
with the specified configuration.proxy
(@NonNull HttpRequest<?> request) Proxy the given request and emit the response.default Publisher<MutableHttpResponse<?>>
proxy
(@NonNull HttpRequest<?> request, @NonNull ProxyRequestOptions options) Proxy the given request and emit the response.
-
Method Details
-
proxy
Proxy the given request and emit the response. This method expects the full absolute URL to be included in the request. If a relative URL is specified then the method will try to resolve the URI for the current server otherwise an exception will be thrown.- Parameters:
request
- The request- Returns:
- A publisher that emits the response.
-
proxy
default Publisher<MutableHttpResponse<?>> proxy(@NonNull @NonNull HttpRequest<?> request, @NonNull @NonNull ProxyRequestOptions options) Proxy the given request and emit the response. This method expects the full absolute URL to be included in the request. If a relative URL is specified then the method will try to resolve the URI for the current server otherwise an exception will be thrown.- Parameters:
request
- The requestoptions
- Further options for the proxy request- Returns:
- A publisher that emits the response.
- Since:
- 3.5.0
-
create
Create a newProxyHttpClient
. Note that this method should only be used outside the context of a Micronaut application. The returnedProxyHttpClient
is not subject to dependency injection. The creator is responsible for closing the client to avoid leaking connections. Within a Micronaut application useInject
to inject a client instead.- Parameters:
url
- The base URL- Returns:
- The client
-
create
static ProxyHttpClient create(@Nullable @Nullable URL url, @NonNull @NonNull HttpClientConfiguration configuration) Create a newProxyHttpClient
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- Parameters:
url
- The base URLconfiguration
- the client configuration- Returns:
- The client
- Since:
- 2.2.0
-