Forced hostname to end with /

This commit is contained in:
Winston Li 2014-12-06 00:48:39 +00:00
parent f39199fa7e
commit cfe23b57ff
2 changed files with 7 additions and 5 deletions

View file

@ -39,7 +39,11 @@ public class Config implements JSONSource {
apiKey = getElement(configObject, "apiKey").getAsString();
username = getOptionalString(configObject, "username");
password = getOptionalString(configObject, "password");
hostname = getElement(configObject, "hostname").getAsString();
String hostname = getElement(configObject, "hostname").getAsString();
if (!hostname.endsWith("/")) {
hostname += "/";
}
this.hostname = hostname;
serviceName = getElement(configObject, "serviceName").getAsString();
}

View file

@ -10,10 +10,11 @@ public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
private static String USERNAME;
private static String PASSWORD;
/* Must end with / */
private static String BASE_URL;
public SnapshotAPIRequest(String projectName, String apiCall) {
super(BASE_URL + "/" + projectName + apiCall);
super(BASE_URL + projectName + apiCall);
}
protected Realm buildRequestRealm() {
@ -31,9 +32,6 @@ public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
}
public static void setBaseURL(String baseURL) {
if (!(baseURL.endsWith("/"))) {
baseURL += "/";
}
BASE_URL = baseURL;
}