WebInterface: favicon
This commit is contained in:
@@ -35,6 +35,11 @@ public class IndexHandler implements HttpHandler {
|
||||
|
||||
@Override
|
||||
public void handle(HttpExchange httpExchange) throws IOException {
|
||||
if (httpExchange.getRequestURI().getPath().equals("/favicon.ico")) {
|
||||
favicon(httpExchange);
|
||||
return;
|
||||
}
|
||||
|
||||
String[] requestURIParts = getRequestURIParts(httpExchange.getRequestURI());
|
||||
if (requestURIParts.length > 0) {
|
||||
logger.debug("Module request: {}", requestURIParts[0]);
|
||||
@@ -79,4 +84,19 @@ public class IndexHandler implements HttpHandler {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private void favicon(HttpExchange httpExchange) throws IOException {
|
||||
httpExchange.getResponseHeaders().add("Context-Type","image/x-icon");
|
||||
httpExchange.sendResponseHeaders(200, 0);
|
||||
OutputStream outputStream = httpExchange.getResponseBody();
|
||||
InputStream inputStream = getClass().getResourceAsStream("/static/favicon.ico");
|
||||
final byte[] buffer = new byte[0x10000];
|
||||
int len;
|
||||
while((len = inputStream.read(buffer)) > 0) {
|
||||
outputStream.write(buffer, 0, len);
|
||||
}
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
BIN
webinterface/src/main/resources/static/favicon.ico
Normal file
BIN
webinterface/src/main/resources/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 352 KiB |
Reference in New Issue
Block a user