|
@@ -9,6 +9,8 @@ import io.undertow.util.Headers;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
+import static hello.HelloWebServer.JSON_UTF8;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Handles the JSON test.
|
|
* Handles the JSON test.
|
|
*/
|
|
*/
|
|
@@ -22,7 +24,7 @@ final class JsonHandler implements HttpHandler {
|
|
@Override
|
|
@Override
|
|
public void handleRequest(HttpServerExchange exchange) throws Exception {
|
|
public void handleRequest(HttpServerExchange exchange) throws Exception {
|
|
exchange.getResponseHeaders().put(
|
|
exchange.getResponseHeaders().put(
|
|
- Headers.CONTENT_TYPE, MediaType.JSON_UTF_8.toString());
|
|
|
|
|
|
+ Headers.CONTENT_TYPE, JSON_UTF8);
|
|
exchange.getResponseSender().send(
|
|
exchange.getResponseSender().send(
|
|
objectMapper.writeValueAsString(
|
|
objectMapper.writeValueAsString(
|
|
Collections.singletonMap("message", "Hello, World!")));
|
|
Collections.singletonMap("message", "Hello, World!")));
|