diff --git a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java index 0369beb..3fb15aa 100755 --- a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java +++ b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java @@ -119,20 +119,31 @@ public class SimpleServletDispatcher extends HttpServlet // String path = request.getRequestURI(); String path = request.getPathInfo(); - if ((!path.endsWith("/")) && (!path.endsWith(".xhtml")) && (!path.contains("-/"))) + if (path == null) + { + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + + out.println(""); + out.println("Unknow path."); + out.println(""); + + out.close(); + } + else if ((!path.endsWith("/")) && (!path.endsWith(".xhtml")) && (!path.contains("-/"))) { // path = getServletContext().getRealPath("/") + // request.getRequestURI(); // First, search file in the WebContent root. path = getServletContext().getRealPath("/") + request.getPathInfo(); - logger.info("path1=" + path); + logger.debug("path1=" + path); if (!new File(path).exists()) { // 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=" + path); + logger.debug("path2=" + path); returnInlineFile(response, new File(path), getServletContext().getMimeType(path)); logger.info("File returned directly [" + path + "] with mimetype [" + getServletContext().getMimeType(path) + "].");