From 59e389c9956bd0e6bc157f2c4cd6ca0c476e7e93 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 22 Jul 2013 11:21:13 +0200 Subject: [PATCH] Indent. --- .../kiss4web/SimpleServletDispatcher.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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) + "].");