@Override public String getBodyAsString() { return inner.getBodyAsString(); }
@Override public String getBodyAsString(String encoding) { return inner.getBodyAsString(encoding); }
@Override public String getBodyAsString(String encoding) { return decoratedContext.getBodyAsString(encoding); }
@Override public String getBodyAsString() { return decoratedContext.getBodyAsString(); }
/** * @return the entire HTTP request body as a string, assuming UTF-8 encoding. The context must have first been routed to a {@link io.vertx.rxjava.ext.web.handler.BodyHandler} for this to be populated. */ public String getBodyAsString() { String ret = delegate.getBodyAsString(); return ret; }
/** * @return the entire HTTP request body as a string, assuming UTF-8 encoding. The context must have first been routed to a {@link io.vertx.rxjava.ext.web.handler.BodyHandler} for this to be populated. */ public String getBodyAsString() { String ret = delegate.getBodyAsString(); return ret; }
/** * Get the entire HTTP request body as a string, assuming the specified encoding. The context must have first been routed to a * {@link io.vertx.rxjava.ext.web.handler.BodyHandler} for this to be populated. * @param encoding the encoding, e.g. "UTF-16" * @return the body */ public String getBodyAsString(String encoding) { String ret = delegate.getBodyAsString(encoding); return ret; }
@Override public String getBodyAsString() { return delegate.getBodyAsString(); }
@Override public String getBodyAsString() { return decoratedContext.getBodyAsString(); }
@Test public void testBodyString() throws Exception { String str = "sausages"; router.route().handler(rc -> { assertEquals(str, rc.getBodyAsString()); rc.response().end(); }); testRequest(HttpMethod.POST, "/", req -> { req.setChunked(true); req.write(str); }, 200, "OK", null); }
@Test public void testBodyStringEncoding() throws Exception { String str = TestUtils.randomUnicodeString(100); String enc = "UTF-16"; router.route().handler(rc -> { assertEquals(str, rc.getBodyAsString(enc)); rc.response().end(); }); testRequest(HttpMethod.POST, "/", req -> { req.setChunked(true); req.write(str, enc); }, 200, "OK", null); }
@Override public @Nullable String getBodyAsString() { return rc.getBodyAsString(); }
private void addRecommendation(RoutingContext ctx) { final String recommendation = ctx.getBodyAsString(); final JsonArray attributes = new JsonArray().add(recommendation); insert(ctx, "INSERT INTO recommendation(name) VALUES (?);", attributes); }
private void addRecommendationToNewColumn(RoutingContext ctx) { final String recommendation = ctx.getBodyAsString(); final JsonArray attributes = new JsonArray().add(recommendation); insert(ctx, "INSERT INTO recommendation(movie_name) VALUES (?);", attributes); }
@Override public <Payload> Dispatcher<String> put(String s, Class<? extends Payload> payloadType, BiConsumer<Payload, RequestContext> handler) { return handler(s, HttpMethod.PUT, (rc, c) -> { Payload payload = JsonSerializer.deserialize(rc.getBodyAsString(), payloadType); handler.accept(payload, c); }); }
private R getRequestBody(RoutingContext routingContext) { String bodyAsString = routingContext.getBodyAsString(); if (isNull(bodyAsString) || bodyAsString.trim().isEmpty()) return makeNewRequest(); return Json.decodeValue(bodyAsString, getRequestClass()); }
private void apiSave(RoutingContext context) { Store store = new Store(new JsonObject(context.getBodyAsString())); if (store.getSellerId() == null) { badRequest(context, new IllegalStateException("Seller id does not exist")); } else { JsonObject result = new JsonObject().put("message", "store_saved") .put("sellerId", store.getSellerId()); service.saveStore(store, resultVoidHandler(context, result)); } }
private void addRecommendationToBothColumns(RoutingContext ctx) { final String recommendation = ctx.getBodyAsString(); final JsonArray attributes = new JsonArray() .add(recommendation) .add(recommendation); insert(ctx, "INSERT INTO recommendation(name, movie_name) VALUES (?,?);", attributes); }
@Test public void testBodyString() throws Exception { String str = "sausages"; router.route().handler(rc -> { assertEquals(str, rc.getBodyAsString()); rc.response().end(); }); testRequest(HttpMethod.POST, "/", req -> { req.setChunked(true); req.write(str); }, 200, "OK", null); }
@Test public void testBodyStringEncoding() throws Exception { String str = TestUtils.randomUnicodeString(100); String enc = "UTF-16"; router.route().handler(rc -> { assertEquals(str, rc.getBodyAsString(enc)); rc.response().end(); }); testRequest(HttpMethod.POST, "/", req -> { req.setChunked(true); req.write(str, enc); }, 200, "OK", null); }