router.route("/anfrage").handler(routingContext -> {
String typ = routingContext.request().getParam("typ");
String name = routingContext.request().getParam("name");
HttpServerResponse response = routingContext.response();
response.putHeader("content-type", "application/json");
JsonObject jo = new JsonObject();
if (typ.equals("namenKnopf")) {
jo.put("typ", "antwort");
jo.put("text", "Der Text war " + name);
}
response.end(Json.encodePrettily(jo));
});
[source,java,indent=0]
----
router.route("/anfrage").handler(routingContext -> {
String typ = routingContext.request().getParam("typ");
String name = routingContext.request().getParam("name");
HttpServerResponse response = routingContext.response();
response.putHeader("content-type", "application/json");
JsonObject jo = new JsonObject();
if (typ.equals("namenKnopf")) {
jo.put("typ", "antwort");
jo.put("text", "Der Text war " + name);
}
response.end(Json.encodePrettily(jo));
});
----