io.micronaut.rxjava3.http.client.BridgedRx3HttpClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micronaut-rxjava3-http-client Show documentation
Show all versions of micronaut-rxjava3-http-client Show documentation
Integration between Micronaut and RxJava 3
/*
* Copyright 2017-2020 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.rxjava3.http.client;
import hu.akarnokd.rxjava3.bridge.RxJavaBridge;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.io.buffer.ByteBuffer;
import io.micronaut.core.type.Argument;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.client.BlockingHttpClient;
import io.micronaut.http.client.RxHttpClient;
import io.micronaut.http.client.RxStreamingHttpClient;
import io.micronaut.http.client.sse.RxSseClient;
import io.micronaut.http.sse.Event;
import io.reactivex.rxjava3.core.Flowable;
import java.util.Map;
/**
* Internal bridge for the HTTP client.
*
* @author graemerocher
* @since 1.0
*/
@Internal
class BridgedRx3HttpClient implements Rx3HttpClient, Rx3SseClient, Rx3StreamingHttpClient {
private final RxHttpClient rxHttpClient;
public BridgedRx3HttpClient(RxHttpClient rxHttpClient) {
this.rxHttpClient = rxHttpClient;
}
@Override
public BlockingHttpClient toBlocking() {
return null;
}
@Override
public Flowable> exchange(HttpRequest request, Argument bodyType, Argument errorType) {
return RxJavaBridge.toV3Flowable(rxHttpClient.exchange(request, bodyType, errorType));
}
@Override
public Flowable> exchange(HttpRequest request, Argument bodyType) {
return RxJavaBridge.toV3Flowable(rxHttpClient.exchange(request, bodyType));
}
@Override
public Flowable retrieve(HttpRequest request, Argument bodyType, Argument errorType) {
return RxJavaBridge.toV3Flowable(rxHttpClient.retrieve(request, bodyType));
}
@Override
public Flowable> exchange(HttpRequest request) {
return RxJavaBridge.toV3Flowable(rxHttpClient.exchange(request));
}
@Override
public Flowable> exchange(String uri) {
return RxJavaBridge.toV3Flowable(rxHttpClient.exchange(uri));
}
@Override
public Flowable> exchange(String uri, Class bodyType) {
return RxJavaBridge.toV3Flowable(rxHttpClient.exchange(uri, bodyType));
}
@Override
public Flowable> exchange(HttpRequest request, Class bodyType) {
return RxJavaBridge.toV3Flowable(rxHttpClient.exchange(request, bodyType));
}
@Override
public Flowable retrieve(HttpRequest request, Argument bodyType) {
return RxJavaBridge.toV3Flowable(rxHttpClient.retrieve(request, bodyType));
}
@Override
public Flowable retrieve(HttpRequest request, Class bodyType) {
return RxJavaBridge.toV3Flowable(rxHttpClient.retrieve(request, bodyType));
}
@Override
public Flowable retrieve(HttpRequest request) {
return RxJavaBridge.toV3Flowable(rxHttpClient.retrieve(request));
}
@Override
public Flowable retrieve(String uri) {
return RxJavaBridge.toV3Flowable(rxHttpClient.retrieve(uri));
}
@Override
public boolean isRunning() {
return rxHttpClient.isRunning();
}
@Override
public Flowable>> eventStream(HttpRequest request) {
return RxJavaBridge.toV3Flowable(((RxSseClient) rxHttpClient).eventStream(request));
}
@Override
public Flowable> eventStream(HttpRequest request, Argument eventType) {
return RxJavaBridge.toV3Flowable(((RxSseClient) rxHttpClient).eventStream(request, eventType));
}
@Override
public Flowable> eventStream(HttpRequest request, Class eventType) {
return RxJavaBridge.toV3Flowable(((RxSseClient) rxHttpClient).eventStream(request, eventType));
}
@Override
public Flowable> eventStream(String uri, Class eventType) {
return RxJavaBridge.toV3Flowable(((RxSseClient) rxHttpClient).eventStream(uri, eventType));
}
@Override
public Flowable> eventStream(String uri, Argument eventType) {
return RxJavaBridge.toV3Flowable(((RxSseClient) rxHttpClient).eventStream(uri, eventType));
}
@Override
public Flowable> dataStream(HttpRequest request) {
return RxJavaBridge.toV3Flowable(((RxStreamingHttpClient) rxHttpClient).dataStream(request));
}
@Override
public Flowable>> exchangeStream(HttpRequest request) {
return RxJavaBridge.toV3Flowable(((RxStreamingHttpClient) rxHttpClient).exchangeStream(request));
}
@Override
public Flowable