WebInterface: favicon
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
group = 'asys'
|
group = 'asys'
|
||||||
version = '0.18-SNAPSHOT'
|
version = '0.18.1-SNAPSHOT'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ public class IndexHandler implements HttpHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(HttpExchange httpExchange) throws IOException {
|
public void handle(HttpExchange httpExchange) throws IOException {
|
||||||
|
if (httpExchange.getRequestURI().getPath().equals("/favicon.ico")) {
|
||||||
|
favicon(httpExchange);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String[] requestURIParts = getRequestURIParts(httpExchange.getRequestURI());
|
String[] requestURIParts = getRequestURIParts(httpExchange.getRequestURI());
|
||||||
if (requestURIParts.length > 0) {
|
if (requestURIParts.length > 0) {
|
||||||
logger.debug("Module request: {}", requestURIParts[0]);
|
logger.debug("Module request: {}", requestURIParts[0]);
|
||||||
@@ -79,4 +84,19 @@ public class IndexHandler implements HttpHandler {
|
|||||||
return result;
|
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