本文整理了Java中io.reactivex.netty.protocol.http.client.HttpClient.createGet()
方法的一些代码示例,展示了HttpClient.createGet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.createGet()
方法的具体详情如下:
包路径:io.reactivex.netty.protocol.http.client.HttpClient
类名称:HttpClient
方法名:createGet
暂无
代码示例来源:origin: org.springframework/spring-web-reactive
private WebSocketRequest<ByteBuf> createRequest(URI url, HttpHeaders headers, String[] protocols) {
String query = url.getRawQuery();
String requestUrl = url.getRawPath() + (query != null ? "?" + query : "");
HttpClientRequest<ByteBuf, ByteBuf> request = getHttpClient(url).createGet(requestUrl);
if (!headers.isEmpty()) {
Map<String, List<Object>> map = new HashMap<>(headers.size());
headers.forEach((key, values) -> map.put(key, new ArrayList<>(headers.get(key))));
request = request.setHeaders(map);
}
return (ObjectUtils.isEmpty(protocols) ?
request.requestWebSocketUpgrade() :
request.requestWebSocketUpgrade().requestSubProtocols(protocols));
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Test
public void sample_22() throws Exception {
Observable<URL> sources = Observable.just(new URL("http://www.google.com"));
Observable<ByteBuf> packets =
sources
.flatMap(url -> HttpClient
.newClient(url.getHost(), url.getPort())
.createGet(url.getPath()))
.flatMap(HttpClientResponse::getContent);
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Test
public void sample_9() throws Exception {
Observable<ByteBuf> response = HttpClient
.newClient("example.com", 80)
.createGet("/")
.flatMap(HttpClientResponse::getContent);
response
.map(bb -> bb.toString(UTF_8))
.subscribe(System.out::println);
}
内容来源于网络,如有侵权,请联系作者删除!