Web interface: чуток упростил загрузку index.html
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user