@Override public void start() throws Exception { // Create two requests WebClient client = WebClient.create(vertx); Single<JsonObject> request = client.get(8080, "localhost", "/") .as(BodyCodec.jsonObject()) .rxSend() .map(resp -> resp.body()); // Combine the responses with the zip into a single response request .zipWith(request, (b1, b2) -> new JsonObject().put("req1", b1).put("req2", b2)) .subscribe(json -> { System.out.println("Got combined result " + json); }, err -> { err.printStackTrace(); }); } }
@Override public void start() throws Exception { WebClient client = WebClient.create(vertx); Single<HttpResponse<Data>> request = client.get(8080, "localhost", "/") .as(BodyCodec.json(Data.class)) .rxSend(); // Fire the request request.subscribe(resp -> System.out.println("Server content " + resp.body().message)); // Again request.subscribe(resp -> System.out.println("Server content " + resp.body().message)); // And again request.subscribe(resp -> System.out.println("Server content " + resp.body().message)); } }
@Override public void start() throws Exception { WebClient client = WebClient.create(vertx); Single<HttpResponse<String>> request = client.get(8080, "localhost", "/") .as(BodyCodec.string()) .rxSend(); // Fire the request request.subscribe(resp -> System.out.println("Server content " + resp.body())); // Again request.subscribe(resp -> System.out.println("Server content " + resp.body())); // And again request.subscribe(resp -> System.out.println("Server content " + resp.body())); } }
/** * @return the codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<io.vertx.rxjava.core.buffer.Buffer> buffer() { io.vertx.rxjava.ext.web.codec.BodyCodec<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.buffer(), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
public static <T>BodyCodec<T> newInstance(io.vertx.ext.web.codec.BodyCodec arg, io.vertx.lang.rx.TypeArg<T> __typeArg_T) { return arg != null ? new BodyCodec<T>(arg, __typeArg_T) : null; } }
/** * Configure the request to decode the response with the <code>responseCodec</code>. * @param responseCodec the response codec * @return a reference to this, so the API can be used fluently */ public <U> io.vertx.rxjava.ext.web.client.HttpRequest<U> as(io.vertx.rxjava.ext.web.codec.BodyCodec<U> responseCodec) { io.vertx.rxjava.ext.web.client.HttpRequest<U> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.as(responseCodec.getDelegate()), responseCodec.__typeArg_0); return ret; }
/** * @return the codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<io.vertx.rxjava.core.buffer.Buffer> buffer() { io.vertx.rxjava.ext.web.codec.BodyCodec<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.buffer(), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
public static <T>BodyCodec<T> newInstance(io.vertx.ext.web.codec.BodyCodec arg, io.vertx.lang.rx.TypeArg<T> __typeArg_T) { return arg != null ? new BodyCodec<T>(arg, __typeArg_T) : null; } }
/** * Configure the request to decode the response with the <code>responseCodec</code>. * @param responseCodec the response codec * @return a reference to this, so the API can be used fluently */ public <U> io.vertx.rxjava.ext.web.client.HttpRequest<U> as(io.vertx.rxjava.ext.web.codec.BodyCodec<U> responseCodec) { io.vertx.rxjava.ext.web.client.HttpRequest<U> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.as(responseCodec.getDelegate()), responseCodec.__typeArg_0); return ret; }
/** * @return a codec that simply discards the response */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<Void> none() { io.vertx.rxjava.ext.web.codec.BodyCodec<Void> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.none(), io.vertx.lang.rx.TypeArg.unknown()); return ret; }
public static <T>BodyCodec<T> newInstance(io.vertx.ext.web.codec.BodyCodec arg) { return arg != null ? new BodyCodec<T>(arg) : null; }
/** * @return the codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<JsonArray> jsonArray() { io.vertx.rxjava.ext.web.codec.BodyCodec<JsonArray> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.jsonArray(), io.vertx.lang.rx.TypeArg.unknown()); return ret; }
public static <T>BodyCodec<T> newInstance(io.vertx.ext.web.codec.BodyCodec arg) { return arg != null ? new BodyCodec<T>(arg) : null; }
/** * @return a codec that simply discards the response */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<Void> none() { io.vertx.rxjava.ext.web.codec.BodyCodec<Void> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.none(), io.vertx.lang.rx.TypeArg.unknown()); return ret; }
/** * A codec for strings using a specific <code>encoding</code>. * @param encoding the encoding * @return the codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<String> string(String encoding) { io.vertx.rxjava.ext.web.codec.BodyCodec<String> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.string(encoding), io.vertx.lang.rx.TypeArg.unknown()); return ret; }
/** * @return the codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<JsonArray> jsonArray() { io.vertx.rxjava.ext.web.codec.BodyCodec<JsonArray> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.jsonArray(), io.vertx.lang.rx.TypeArg.unknown()); return ret; }
/** * @return the UTF-8 string codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<String> string() { io.vertx.rxjava.ext.web.codec.BodyCodec<String> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.string(), io.vertx.lang.rx.TypeArg.unknown()); return ret; }
/** * @return the UTF-8 string codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<String> string() { io.vertx.rxjava.ext.web.codec.BodyCodec<String> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.string(), io.vertx.lang.rx.TypeArg.unknown()); return ret; }
/** * @return the codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<JsonObject> jsonObject() { io.vertx.rxjava.ext.web.codec.BodyCodec<JsonObject> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.jsonObject(), io.vertx.lang.rx.TypeArg.unknown()); return ret; }
/** * @return the codec */ public static io.vertx.rxjava.ext.web.codec.BodyCodec<JsonObject> jsonObject() { io.vertx.rxjava.ext.web.codec.BodyCodec<JsonObject> ret = io.vertx.rxjava.ext.web.codec.BodyCodec.newInstance(io.vertx.ext.web.codec.BodyCodec.jsonObject(), io.vertx.lang.rx.TypeArg.unknown()); return ret; }