Archived
0

MCSM: компонент WebConsole

This commit is contained in:
2017-05-09 20:32:45 +03:00
parent 1085688d1c
commit 86c506dff2
4 changed files with 50 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ public class MCSM_WebModule extends WebModule {
private final String MODULE_NAME = "mcsmanager";
private final String MODULE_URL = "/"+MODULE_NAME;
private final Pattern URL_PATTERN_JS = Pattern.compile(MODULE_URL+"/(\\w+)\\.js");
private final Pattern URL_PATTERN_CSS = Pattern.compile(MODULE_URL+"/(\\w+)\\.css");
private Manager manager;
MCSM_WebModule(Manager manager) {
@@ -66,6 +67,19 @@ public class MCSM_WebModule extends WebModule {
this.sendContent(httpExchange, 0, stream);
return true;
}
//FIXME дублирование кода
matcher = URL_PATTERN_CSS.matcher(urlPath);
if (matcher.find()) {
InputStream stream = getClass().getResourceAsStream("/" + matcher.group(1) + ".css");
if (stream == null) {
this.sendHttpCode(httpExchange, 404, "not found");
return true;
}
httpExchange.getResponseHeaders().add("Content-Type", "text/css;charset=utf-8");
this.sendContent(httpExchange, 0, stream);
return true;
}
}
return false;