From b2b1301892d1a41921a4ee37b53b1b6a898e9683 Mon Sep 17 00:00:00 2001 From: Rohit Awate Date: Sat, 27 Jan 2018 17:20:38 +0530 Subject: [PATCH] Added HTML support and made ResponseArea non-editable --- .../dashboard/DashboardController.java | 1 - .../restaurant/requests/RequestManager.java | 6 +++++- src/main/resources/fxml/Dashboard.fxml | 16 +++++----------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/rohitawate/restaurant/dashboard/DashboardController.java b/src/main/java/com/rohitawate/restaurant/dashboard/DashboardController.java index 4668de8..b2d666b 100644 --- a/src/main/java/com/rohitawate/restaurant/dashboard/DashboardController.java +++ b/src/main/java/com/rohitawate/restaurant/dashboard/DashboardController.java @@ -59,7 +59,6 @@ public class DashboardController implements Initializable { responseBox.getChildren().remove(0); httpMethodBox.getItems().addAll(httpMethods); httpMethodBox.setValue("GET"); - responseArea.wrapTextProperty().set(true); requestManager = new RequestManager(); snackBar = new JFXSnackbar(dashboard); diff --git a/src/main/java/com/rohitawate/restaurant/requests/RequestManager.java b/src/main/java/com/rohitawate/restaurant/requests/RequestManager.java index 71a7696..30a5f8e 100644 --- a/src/main/java/com/rohitawate/restaurant/requests/RequestManager.java +++ b/src/main/java/com/rohitawate/restaurant/requests/RequestManager.java @@ -53,7 +53,7 @@ public class RequestManager { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); - switch (type) { + switch (type.toLowerCase()) { case "application/json": JsonNode node = mapper.readTree(responseBody); response.setBody(mapper.writeValueAsString(node)); @@ -61,6 +61,10 @@ public class RequestManager { case "application/xml": response.setBody(mapper.writeValueAsString(responseBody)); break; + case "text/html": + case "text/html; charset=utf-8": + response.setBody(responseBody); + break; } response.setMediaType(serverResponse.getMediaType()); diff --git a/src/main/resources/fxml/Dashboard.fxml b/src/main/resources/fxml/Dashboard.fxml index 398cc58..c38415b 100644 --- a/src/main/resources/fxml/Dashboard.fxml +++ b/src/main/resources/fxml/Dashboard.fxml @@ -1,18 +1,12 @@ - - - - - + + - - - - - + +
@@ -95,7 +89,7 @@ -