commit 2b9f18ca46b5dcdd910a7c2bd8573461ec600b7a
parent 4d18a3f33ad100caf97bb41ca7b90fef52f1742f
Author: Jan Dankert <devnull@localhost>
Date: Wed, 12 Dec 2018 16:14:44 +0100
Auto-append the '/api' in the URL.
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/de/openrat/client/CMSClient.java b/src/de/openrat/client/CMSClient.java
@@ -209,7 +209,7 @@ public class CMSClient
/**
* closing all resources. Normally, you do not need to call this, because
- * the sockets are closed after each call. this is only for future vesions
+ * the sockets are closed after each call. this is only for future versions
* wenn keep-alive is implemented.
*
*/
diff --git a/src/de/openrat/client/util/HttpClient.java b/src/de/openrat/client/util/HttpClient.java
@@ -79,6 +79,9 @@ public class HttpClient
{
String httpUrl = this.connection.getServerPath();
+ // Do NOT use the UI, always use the API.
+ httpUrl = addTrailingSlash(httpUrl) + "api/";
+
final PrintWriter socketWriter = new PrintWriter(socket.getOutputStream(), true);
if (connection.getProxyHostname() != null)
@@ -247,6 +250,13 @@ public class HttpClient
}
}
+ private String addTrailingSlash(String httpUrl) {
+ if (httpUrl.endsWith("/"))
+ return httpUrl;
+ else
+ return httpUrl + "/";
+ }
+
public Socket createSocket() throws IOException
{