MCSM: компонент WebConsole
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user