Codota Logo
BodyCodec
Code IndexAdd Codota to your IDE (free)

How to use
BodyCodec
in
io.vertx.rxjava.ext.web.codec

Best Java code snippets using io.vertx.rxjava.ext.web.codec.BodyCodec (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: vert-x3/vertx-examples

 @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));
 }
}
origin: vert-x3/vertx-examples

 @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();
   });
 }
}
origin: vert-x3/vertx-examples

 @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()));
 }
}
origin: vert-x3/vertx-rx

/**
 * @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;
}
origin: io.vertx/vertx-rx-java

 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;
 }
}
origin: vert-x3/vertx-rx

/**
 * 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;
}
origin: vert-x3/vertx-rx

@Test
public void testGet() {
 int times = 5;
 waitFor(times);
 HttpServer server = vertx.createHttpServer(new HttpServerOptions().setPort(8080));
 server.requestStream().handler(req -> req.response().setChunked(true).end("some_content"));
 try {
  server.listen(ar -> {
   client = WebClient.wrap(vertx.createHttpClient(new HttpClientOptions()));
   Single<HttpResponse<Buffer>> single = client
    .get(8080, "localhost", "/the_uri")
    .as(BodyCodec.buffer())
    .rxSend();
   for (int i = 0; i < times; i++) {
    single.subscribe(resp -> {
     Buffer body = resp.body();
     assertEquals("some_content", body.toString("UTF-8"));
     complete();
    }, this::fail);
   }
  });
  await();
 } finally {
  server.close();
 }
}
origin: io.vertx/vertx-rx-java

/**
 * @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;
}
origin: vert-x3/vertx-rx

 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;
 }
}
origin: io.vertx/vertx-rx-java

/**
 * 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;
}
origin: io.vertx/vertx-rx-java

/**
 * @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;
}
origin: vert-x3/vertx-rx

 @Test
 public void testErrorHandling() throws Exception {
  try {
   client = WebClient.wrap(vertx.createHttpClient(new HttpClientOptions()));
   Single<HttpResponse<WineAndCheese>> single = client
    .get(-1, "localhost", "/the_uri")
    .as(BodyCodec.json(WineAndCheese.class))
    .rxSend();
   single.subscribe(resp -> fail(), error -> {
    assertEquals(IllegalArgumentException.class, error.getClass());
    testComplete();
   });
   await();
  } catch (Throwable t) {
   fail();
  }
 }
}
origin: vert-x3/vertx-rx

public static <T>BodyCodec<T> newInstance(io.vertx.ext.web.codec.BodyCodec arg) {
 return arg != null ? new BodyCodec<T>(arg) : null;
}
origin: io.vertx/vertx-rx-java

/**
 * @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;
}
origin: vert-x3/vertx-rx

@Test
public void testResponseBodyAsAsJsonMapped() throws Exception {
 JsonObject expected = new JsonObject().put("cheese", "Goat Cheese").put("wine", "Condrieu");
 HttpServer server = vertx.createHttpServer(new HttpServerOptions().setPort(8080));
 server.requestStream().handler(req -> req.response().end(expected.encode()));
 try {
  server.listen(ar -> {
   client = WebClient.wrap(vertx.createHttpClient(new HttpClientOptions()));
   Single<HttpResponse<WineAndCheese>> single = client
    .get(8080, "localhost", "/the_uri")
    .as(BodyCodec.json(WineAndCheese.class))
    .rxSend();
   single.subscribe(resp -> {
    assertEquals(200, resp.statusCode());
    assertEquals(new WineAndCheese().setCheese("Goat Cheese").setWine("Condrieu"), resp.body());
    testComplete();
   }, this::fail);
  });
  await();
 } finally {
  server.close();
 }
}
origin: io.vertx/vertx-rx-java

public static <T>BodyCodec<T> newInstance(io.vertx.ext.web.codec.BodyCodec arg) {
 return arg != null ? new BodyCodec<T>(arg) : null;
}
origin: vert-x3/vertx-rx

/**
 * @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;
}
origin: io.vertx/vertx-rx-java

/**
 * 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;
}
origin: vert-x3/vertx-rx

/**
 * @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;
}
origin: vert-x3/vertx-rx

/**
 * @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;
}
io.vertx.rxjava.ext.web.codecBodyCodec

Javadoc

A codec for encoding and decoding HTTP bodies.

NOTE: This class has been automatically generated from the io.vertx.ext.web.codec.BodyCodec non RX-ified interface using Vert.x codegen.

Most used methods

  • json
    Create and return a codec for Java objects encoded using Jackson mapper.
  • <init>
  • buffer
  • getDelegate
  • jsonObject
  • newInstance
  • string
    A codec for strings using a specific encoding.

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • getSystemService (Context)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JList (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now