Package io.micronaut.http.client
Interface ProxyHttpClient
public interface ProxyHttpClient
Interface that allows proxying of HTTP requests in controllers and filters.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProxyHttpClientCreate a newProxyHttpClient.static ProxyHttpClientcreate(URL url, HttpClientConfiguration configuration) Create a newProxyHttpClientwith the specified configuration.org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>>proxy(io.micronaut.http.HttpRequest<?> request) Proxy the given request and emit the response.default org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>>proxy(io.micronaut.http.HttpRequest<?> request, ProxyRequestOptions options) Proxy the given request and emit the response.
-
Method Details
-
proxy
org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> proxy(@NonNull io.micronaut.http.HttpRequest<?> request) 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 org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> proxy(@NonNull io.micronaut.http.HttpRequest<?> request, @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 of the context of a Micronaut application. The returnedProxyHttpClientis not subject to dependency injection. The creator is responsible for closing the client to avoid leaking connections. Within a Micronaut application useInjectto inject a client instead.- Parameters:
url- The base URL- Returns:
- The client
-
create
Create a newProxyHttpClientwith the specified configuration. Note that this method should only be used outside of the context of an application. Within Micronaut useInjectto inject a client instead- Parameters:
url- The base URLconfiguration- the client configuration- Returns:
- The client
- Since:
- 2.2.0
-