Added automatic prepending of protocol

This commit is contained in:
Rohit Awate 2018-06-04 15:16:56 +05:30
parent d837cd5000
commit 6e74b4dbab
No known key found for this signature in database
GPG key ID: 1051D7B79CF2EE25
4 changed files with 18 additions and 45 deletions

View file

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.jfoenix:jfoenix:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-client:2.26" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-common:2.26" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:javax.inject:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: javax.ws.rs:javax.ws.rs-api:2.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-multipart:2.26" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.mimepull:mimepull:1.9.6" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.inject:jersey-hk2:2.26" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-locator:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-api:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-utils:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.22.0-CR2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.21.0.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:24.1-jre" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Maven: org.checkerframework:checker-compat-qual:2.0.0" level="project" />
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.1.3" level="project" />
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.mojo:animal-sniffer-annotations:1.14" level="project" />
</component>
</module>

View file

@ -183,6 +183,14 @@ public class DashboardController implements Initializable {
try {
String address = addressField.getText();
// Prepends "https://" to the address if not already done.
if (!address.startsWith("https://") || !address.startsWith("http://")) {
address = "https://" + address;
addressField.setText(address);
responseArea.requestFocus();
}
if (address.equals("")) {
promptLayer.setVisible(true);
snackbar.show("Please enter an address.", 3000);
@ -193,7 +201,7 @@ public class DashboardController implements Initializable {
if (getRequest == null)
getRequest = new GETRequest();
getRequest.setTarget(addressField.getText());
getRequest.setTarget(address);
getRequest.setHeaders(headerTabController.getSelectedHeaders());
requestManager = Services.pool.get();
@ -210,7 +218,7 @@ public class DashboardController implements Initializable {
dataRequest = new DataDispatchRequest();
dataRequest.setRequestType(httpMethodBox.getValue());
dataRequest.setTarget(addressField.getText());
dataRequest.setTarget(address);
dataRequest.setHeaders(headerTabController.getSelectedHeaders());
if (bodyTabController.rawTab.isSelected()) {
@ -256,7 +264,7 @@ public class DashboardController implements Initializable {
if (deleteRequest == null)
deleteRequest = new DELETERequest();
deleteRequest.setTarget(addressField.getText());
deleteRequest.setTarget(address);
deleteRequest.setHeaders(headerTabController.getSelectedHeaders());
requestManager = Services.pool.delete();
@ -366,12 +374,13 @@ public class DashboardController implements Initializable {
String responseBody = response.getBody();
visualizerTab.setDisable(true);
visualizer.clear();
try {
if (type != null) {
// Selects only the part preceding the ';', skipping the character encoding
type = type.split(";")[0];
visualizerTab.setDisable(true);
switch (type.toLowerCase()) {
case "application/json":
responseType.setText("JSON");

View file

@ -112,4 +112,8 @@ class Visualizer extends ScrollPane {
rootItem.getChildren().addAll(items);
}
public void clear() {
this.visualizer.setRoot(null);
}
}

View file

@ -59,7 +59,7 @@ public class SettingsLoader implements Runnable {
Settings.theme = EverestUtilities.trimString(setStringSetting(Settings.theme, "theme"));
Settings.showHistoryRange = setIntegerSetting(Settings.showHistoryRange, "showHistoryRange");
} catch (IOException IOE) {
Services.loggingService.logInfo("Settings file not found. Using defaults", LocalDateTime.now());
Services.loggingService.logInfo("Settings file not found. Using defaults.", LocalDateTime.now());
}
}