@Override public void start() throws Exception { WebClient client = WebClient.create(vertx); JsonObject user = new JsonObject() .put("firstName", "Dale") .put("lastName", "Cooper") .put("male", true); client.put(8080, "localhost", "/").sendJson(user, ar -> { if (ar.succeeded()) { HttpResponse<Buffer> response = ar.result(); System.out.println("Got HTTP response with status " + response.statusCode()); } else { ar.cause().printStackTrace(); } }); } }
@Override public void start() throws Exception { WebClient client = WebClient.create(vertx); Buffer body = Buffer.buffer("Hello World"); client.put(8080, "localhost", "/").sendBuffer(body, ar -> { if (ar.succeeded()) { HttpResponse<Buffer> response = ar.result(); System.out.println("Got HTTP response with status " + response.statusCode()); } else { ar.cause().printStackTrace(); } }); } }
@Override public void start() throws Exception { WebClient client = WebClient.create(vertx); User user = new User(); user.firstName = "Dale"; user.lastName = "Cooper"; user.male = true; client.put(8080, "localhost", "/").sendJson(user, ar -> { if (ar.succeeded()) { HttpResponse<Buffer> response = ar.result(); System.out.println("Got HTTP response with status " + response.statusCode()); } else { ar.cause().printStackTrace(); } }); } }
@Override public void start() throws Exception { String filename = "upload.txt"; FileSystem fs = vertx.fileSystem(); WebClient client = WebClient.create(vertx); fs.props(filename, ares -> { FileProps props = ares.result(); System.out.println("props is " + props); long size = props.size(); HttpRequest<Buffer> req = client.put(8080, "localhost", "/"); req.putHeader("content-length", "" + size); fs.open(filename, new OpenOptions(), ares2 -> { req.sendStream(ares2.result(), ar -> { if (ar.succeeded()) { HttpResponse<Buffer> response = ar.result(); System.out.println("Got HTTP response with status " + response.statusCode()); } else { ar.cause().printStackTrace(); } }); }); }); } }
/** * Create an HTTP PUT request to send to the server at the specified host and default port. * @param host the host * @param requestURI the relative URI * @return an HTTP client request object */ public io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> put(String host, String requestURI) { io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.put(host, requestURI), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
/** * Create an HTTP PUT request to send to the server at the specified host and default port. * @param host the host * @param requestURI the relative URI * @return an HTTP client request object */ public io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> put(String host, String requestURI) { io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.put(host, requestURI), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
/** * Create an HTTP PUT request to send to the server at the specified host and port. * @param port the port * @param host the host * @param requestURI the relative URI * @return an HTTP client request object */ public io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> put(int port, String host, String requestURI) { io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.put(port, host, requestURI), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
/** * Create an HTTP PUT request to send to the server at the default host and port. * @param requestURI the relative URI * @return an HTTP client request object */ public io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> put(String requestURI) { io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.put(requestURI), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
/** * Create an HTTP PUT request to send to the server at the default host and port. * @param requestURI the relative URI * @return an HTTP client request object */ public io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> put(String requestURI) { io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.put(requestURI), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
/** * Create an HTTP PUT request to send to the server at the specified host and port. * @param port the port * @param host the host * @param requestURI the relative URI * @return an HTTP client request object */ public io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> put(int port, String host, String requestURI) { io.vertx.rxjava.ext.web.client.HttpRequest<io.vertx.rxjava.core.buffer.Buffer> ret = io.vertx.rxjava.ext.web.client.HttpRequest.newInstance(delegate.put(port, host, requestURI), io.vertx.rxjava.core.buffer.Buffer.__TYPE_ARG); return ret; }
break; case PUT: builder = client.put(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/somepath"); break; case PATCH: