Added HTML support and made ResponseArea non-editable

This commit is contained in:
Rohit Awate 2018-01-27 17:20:38 +05:30
parent 613792fda3
commit b2b1301892
3 changed files with 10 additions and 13 deletions

View file

@ -59,7 +59,6 @@ public class DashboardController implements Initializable {
responseBox.getChildren().remove(0); responseBox.getChildren().remove(0);
httpMethodBox.getItems().addAll(httpMethods); httpMethodBox.getItems().addAll(httpMethods);
httpMethodBox.setValue("GET"); httpMethodBox.setValue("GET");
responseArea.wrapTextProperty().set(true);
requestManager = new RequestManager(); requestManager = new RequestManager();
snackBar = new JFXSnackbar(dashboard); snackBar = new JFXSnackbar(dashboard);

View file

@ -53,7 +53,7 @@ public class RequestManager {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.INDENT_OUTPUT, true); mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
switch (type) { switch (type.toLowerCase()) {
case "application/json": case "application/json":
JsonNode node = mapper.readTree(responseBody); JsonNode node = mapper.readTree(responseBody);
response.setBody(mapper.writeValueAsString(node)); response.setBody(mapper.writeValueAsString(node));
@ -61,6 +61,10 @@ public class RequestManager {
case "application/xml": case "application/xml":
response.setBody(mapper.writeValueAsString(responseBody)); response.setBody(mapper.writeValueAsString(responseBody));
break; break;
case "text/html":
case "text/html; charset=utf-8":
response.setBody(responseBody);
break;
} }
response.setMediaType(serverResponse.getMediaType()); response.setMediaType(serverResponse.getMediaType());

View file

@ -1,18 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?> <?import com.jfoenix.controls.JFXButton?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.*?>
<?import javafx.scene.control.ComboBox?> <?import javafx.scene.control.*?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?> <?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.*?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.text.*?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<BorderPane fx:id="dashboard" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="720.0" prefWidth="1280.0" stylesheets="@../styles/Default.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.rohitawate.restaurant.dashboard.DashboardController"> <BorderPane fx:id="dashboard" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="720.0" prefWidth="1280.0" stylesheets="@../styles/Default.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.rohitawate.restaurant.dashboard.DashboardController">
<center> <center>
<VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER"> <VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER">
@ -95,7 +89,7 @@
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/>
</padding> </padding>
</HBox> </HBox>
<TextArea fx:id="responseArea" wrapText="true" VBox.vgrow="ALWAYS"/> <TextArea fx:id="responseArea" editable="false" wrapText="true" VBox.vgrow="ALWAYS"/>
</children> </children>
</VBox> </VBox>
</children> </children>