Commit 836564ea authored by leMaik's avatar leMaik
Browse files

Add logging for remote files.

parent 20c6326c
......@@ -3,6 +3,8 @@ package net.cubespace.dynmap.multiserver;
import net.cubespace.dynmap.multiserver.Config.Dynmap;
import net.cubespace.dynmap.multiserver.util.AbstractFile;
import net.cubespace.dynmap.multiserver.util.HttpRemoteFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
......@@ -11,6 +13,7 @@ import java.io.IOException;
* @author geNAZt (fabian.fassbender42@googlemail.com)
*/
public class HttpRemoteDynmapServer extends AbstractDynmapServer {
static Logger logger = LoggerFactory.getLogger(HttpRemoteDynmapServer.class);
private final String url;
public HttpRemoteDynmapServer(Dynmap config) {
......@@ -21,18 +24,23 @@ public class HttpRemoteDynmapServer extends AbstractDynmapServer {
@Override
public AbstractFile getFile(String path) throws IOException {
path = path.replace(File.separator, "/");
String remoteUrl;
if (url.endsWith("/")) {
if (path.startsWith("/")) {
return new HttpRemoteFile(url + path.substring(1));
remoteUrl = url + path.substring(1);
} else {
return new HttpRemoteFile(url + path);
remoteUrl = url + path;
}
} else {
if (path.startsWith("/")) {
return new HttpRemoteFile(url + path);
remoteUrl = url + path;
} else {
return new HttpRemoteFile(url + "/" + path);
remoteUrl = url + "/" + path;
}
}
logger.info(path + " --> " + remoteUrl);
return new HttpRemoteFile(url);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment