本文整理了Java中reactor.netty.http.client.HttpClient.baseUrl()
方法的一些代码示例,展示了HttpClient.baseUrl()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.baseUrl()
方法的具体详情如下:
包路径:reactor.netty.http.client.HttpClient
类名称:HttpClient
方法名:baseUrl
[英]Configure URI to use for this request/response
[中]配置用于此请求/响应的URI
代码示例来源:origin: reactor/reactor-netty
@Test
public void simpleTest404() {
doSimpleTest404(HttpClient.create()
.baseUrl("google.com"));
}
代码示例来源:origin: com.rabbitmq/http-client
public ReactorNettyClient(String url, String username, String password, ReactorNettyClientOptions options) {
objectMapper = options.objectMapper() == null ? createDefaultObjectMapper() : options.objectMapper().get();
client = options.client() == null ?
HttpClient.create().baseUrl(url) : options.client().get();
this.token = options.token() == null ? createBasicAuthenticationToken(username, password) : options.token();
if (options.onResponseCallback() == null) {
this.responseCallback = response -> {
if (response.method() == HttpMethod.GET) {
if (response.status().code() >= 500) {
throw new HttpServerException(response.status().code(), response.status().reasonPhrase());
} else if (response.status().code() >= 400) {
throw new HttpClientException(response.status().code(), response.status().reasonPhrase());
}
}
};
} else {
this.responseCallback = response ->
options.onResponseCallback().accept(new HttpEndpoint(response.uri(), response.method().name()), toHttpResponse(response));
}
ByteBufAllocator byteBufAllocator = new PooledByteBufAllocator();
this.byteBufSupplier = () -> byteBufAllocator.buffer();
}
代码示例来源:origin: rabbitmq/hop
public ReactorNettyClient(String url, String username, String password, ReactorNettyClientOptions options) {
objectMapper = options.objectMapper() == null ? createDefaultObjectMapper() : options.objectMapper().get();
client = options.client() == null ?
HttpClient.create().baseUrl(url) : options.client().get();
this.token = options.token() == null ? createBasicAuthenticationToken(username, password) : options.token();
if (options.onResponseCallback() == null) {
this.responseCallback = response -> {
if (response.method() == HttpMethod.GET) {
if (response.status().code() >= 500) {
throw new HttpServerException(response.status().code(), response.status().reasonPhrase());
} else if (response.status().code() >= 400) {
throw new HttpClientException(response.status().code(), response.status().reasonPhrase());
}
}
};
} else {
this.responseCallback = response ->
options.onResponseCallback().accept(new HttpEndpoint(response.uri(), response.method().name()), toHttpResponse(response));
}
ByteBufAllocator byteBufAllocator = new PooledByteBufAllocator();
this.byteBufSupplier = () -> byteBufAllocator.buffer();
}
代码示例来源:origin: reactor/reactor-netty
.baseUrl("http://localhost:" + serverPort1);
内容来源于网络,如有侵权,请联系作者删除!