Каждый URL-адрес сопоставлен с MainServlet
Web.xml:
Код: Выделить всё
MainServlet
/
Код: Выделить всё
public void processor(HttpServletRequest req, HttpServletResponse resp) throws Exception {
String url = req.getRequestURL().toString();
String last = url.substring(url.lastIndexOf(getContext())+getContext().length()+1);
if (getMappingUrls().containsKey(last)){
// handle normal for controller to view dispatch
}
else {
// check for css,js and other ressources
String tot = "";
ServletContext servletContext = req.getServletContext();
URL resourceUrl = servletContext.getResource(last);
try {
File cssFile = new File(resourceUrl.toURI());
FileReader fileReader = new FileReader(cssFile);
BufferedReader reader = new BufferedReader(fileReader);
String line;
while ((line = reader.readLine()) != null) {
tot += line;
}
reader.close();
} catch (IOException | URISyntaxException e) {
}
writer(resp,tot);
}
Однако CSS не применяется к странице, за исключением случаев, когда Я изменяю его в браузере
Буду признателен за любую помощь
Подробнее здесь: https://stackoverflow.com/questions/765 ... -and-other
Мобильная версия