diff --git a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java index 57ac7f3..0369beb 100755 --- a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java +++ b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java @@ -123,13 +123,16 @@ public class SimpleServletDispatcher extends HttpServlet { // path = getServletContext().getRealPath("/") + // request.getRequestURI(); + // First, search file in the WebContent root. path = getServletContext().getRealPath("/") + request.getPathInfo(); - logger.info("path1=" + getServletContext().getRealPath("/")); + logger.info("path1=" + path); if (!new File(path).exists()) { - path = getServletContext().getRealPath("/") + this.webclassesRootPath + "/" + request.getPathInfo(); + // If file is not in WebContent root, search it in packaged + // classes. + path = getServletContext().getRealPath("/") + "WEB-INF/classes/" + this.webclassesRootPath.replaceAll("\\.", "/") + request.getPathInfo(); } - logger.info("path2=" + getServletContext().getRealPath("/") + this.webclassesRootPath); + logger.info("path2=" + path); returnInlineFile(response, new File(path), getServletContext().getMimeType(path)); logger.info("File returned directly [" + path + "] with mimetype [" + getServletContext().getMimeType(path) + "].");