class Main {

    public void parametersAndHeaders() {
        Routing routing = Routing.builder()
                .get("/context/{id}", (req, res) -> {
                    StringBuilder sb = new StringBuilder();
                    // Request headers
                    req.headers()
                       .first("foo")
                       .ifPresent(v -> sb.append("foo: ").append(v).append("\n"));
                    // Request parameters
                    req.queryParams()
                       .first("bar")
                       .ifPresent(v -> sb.append("bar: ").append(v).append("\n"));
                    // Path parameters
                    sb.append("id: ").append(req.path().param("id"));
                    // Response headers
                    res.headers().contentType(MediaType.TEXT_PLAIN);
                    // Response entity (payload)
                    res.send(sb.toString());
                })
                .build();
        startServer(routing);
    }

}