use of io.servicetalk.examples.http.serialization.json.SerializerUtils.REQ_SERIALIZER in project servicetalk by apple.
the class PojoClient method main.
public static void main(String[] args) throws Exception {
try (HttpClient client = HttpClients.forSingleAddress("localhost", 8080).build()) {
client.request(client.post("/pojos").payloadBody(new CreatePojoRequest("value"), REQ_SERIALIZER)).whenOnSuccess(resp -> {
System.out.println(resp.toString((name, value) -> value));
System.out.println(resp.payloadBody(RESP_SERIALIZER));
}).toFuture().get();
}
}
use of io.servicetalk.examples.http.serialization.json.SerializerUtils.REQ_SERIALIZER in project servicetalk by apple.
the class BlockingPojoClient method main.
public static void main(String[] args) throws Exception {
try (BlockingHttpClient client = HttpClients.forSingleAddress("localhost", 8080).buildBlocking()) {
HttpResponse resp = client.request(client.post("/pojos").payloadBody(new CreatePojoRequest("value"), REQ_SERIALIZER));
System.out.println(resp.toString((name, value) -> value));
System.out.println(resp.payloadBody(RESP_SERIALIZER));
}
}
use of io.servicetalk.examples.http.serialization.json.SerializerUtils.REQ_SERIALIZER in project servicetalk by apple.
the class PojoUrlClient method main.
public static void main(String[] args) throws Exception {
try (HttpClient client = HttpClients.forMultiAddressUrl().build()) {
client.request(client.post("http://localhost:8080/pojos").payloadBody(new CreatePojoRequest("value"), REQ_SERIALIZER)).whenOnSuccess(resp -> {
System.out.println(resp.toString((name, value) -> value));
System.out.println(resp.payloadBody(RESP_SERIALIZER));
}).toFuture().get();
}
}
use of io.servicetalk.examples.http.serialization.json.SerializerUtils.REQ_SERIALIZER in project servicetalk by apple.
the class BlockingPojoUrlClient method main.
public static void main(String[] args) throws Exception {
try (BlockingHttpClient client = HttpClients.forMultiAddressUrl().buildBlocking()) {
HttpResponse resp = client.request(client.post("http://localhost:8080/pojos").payloadBody(new CreatePojoRequest("value"), REQ_SERIALIZER));
System.out.println(resp.toString((name, value) -> value));
System.out.println(resp.payloadBody(RESP_SERIALIZER));
}
}
Aggregations