Archived
0

Web interface: чуток упростил загрузку index.html

This commit is contained in:
2017-03-11 23:19:09 +03:00
parent 41c10f3fe1
commit 79976d6b0a
2 changed files with 4 additions and 8 deletions

View File

@@ -29,9 +29,11 @@ bundle {
'Import-Package': '*'
]
exclude group: 'com.google.code.gson'
exclude group: 'commons-io'
}
dependencies {
compile project(':core')
included group: 'com.google.code.gson', name: 'gson', version: '2.7'
included group: 'commons-io', name: 'commons-io', version: '2.5'
}

View File

@@ -6,6 +6,7 @@ package asys.webinterface;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import org.apache.commons.io.IOUtils;
import org.osgi.framework.BundleContext;
import java.io.*;
@@ -21,14 +22,7 @@ public class IndexHandler implements HttpHandler {
try {
InputStream inputStream = getClass().getResourceAsStream("/index.html");
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line).append("\n");
}
htmlTemplate = sb.toString();
htmlTemplate = IOUtils.toString(inputStream, "UTF-8");
} catch (Exception e) {
throw new RuntimeException("Error load htmlTemplate", e);
}