aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/url
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/url')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java18
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java4
3 files changed, 12 insertions, 14 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java
index 725abab9..6e9520ef 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java
@@ -18,18 +18,20 @@
package kr.syeyoung.dungeonsguide.url;
-import kr.syeyoung.dungeonsguide.Authenticator;
+import kr.syeyoung.dungeonsguide.auth.ResourceManager;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class DGConnection extends URLConnection {
- private final Authenticator authenticator;
- protected DGConnection(URL url, Authenticator a) {
+
+ protected DGConnection(URL url) {
super(url);
connected = false;
- this.authenticator = a;
}
@Override
@@ -37,10 +39,10 @@ public class DGConnection extends URLConnection {
}
@Override
public InputStream getInputStream() throws IOException {
- if (authenticator != null) {
+ if (ResourceManager.getInstance().getResources() != null) {
String path = url.getPath().substring(1);
- if (!authenticator.getResources().containsKey(path)) throw new FileNotFoundException();
- return new ByteArrayInputStream(authenticator.getResources().get(path));
+ if (!ResourceManager.getInstance().getResources().containsKey(path)) throw new FileNotFoundException();
+ return new ByteArrayInputStream(ResourceManager.getInstance().getResources().get(path));
}
throw new FileNotFoundException();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java
index bc6fa10d..f740848f 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java
@@ -18,7 +18,6 @@
package kr.syeyoung.dungeonsguide.url;
-import kr.syeyoung.dungeonsguide.Authenticator;
import lombok.AllArgsConstructor;
import java.io.IOException;
@@ -28,9 +27,8 @@ import java.net.URLStreamHandler;
@AllArgsConstructor
public class DGStreamHandler extends URLStreamHandler {
- private final Authenticator auth;
@Override
protected URLConnection openConnection(URL url) throws IOException {
- return new DGConnection(url, this.auth);
+ return new DGConnection(url);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java
index 9f574a86..00b1e5f2 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java
@@ -18,7 +18,6 @@
package kr.syeyoung.dungeonsguide.url;
-import kr.syeyoung.dungeonsguide.Authenticator;
import lombok.AllArgsConstructor;
import java.net.URLStreamHandler;
@@ -26,11 +25,10 @@ import java.net.URLStreamHandlerFactory;
@AllArgsConstructor
public class DGStreamHandlerFactory implements URLStreamHandlerFactory {
- private final Authenticator auth;
@Override
public URLStreamHandler createURLStreamHandler(String protocol) {
if ("z".equals(protocol)) {
- return new DGStreamHandler(this.auth);
+ return new DGStreamHandler();
}
return null;
}