From 653d2bedca7f22a467df78c828005c524e4b9213 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sun, 30 Jun 2013 02:56:12 +0200 Subject: [PATCH] Fix URL dispatching. --- .../kiss4web/SimpleServletDispatcher.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java index 7dda482..8c64d49 100755 --- a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java +++ b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java @@ -32,14 +32,14 @@ public class SimpleServletDispatcher extends HttpServlet private static final long serialVersionUID = -3471226305721330069L; static private Logger logger = LoggerFactory.getLogger(ServletDispatcher.class); - static final protected Pattern SHORT_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-.+\\.xhtml$"); - static final protected Pattern SHORT_REWRITED_URL_PARAMETERS = Pattern.compile("^[^-]+-(.+)\\.xhtml$"); - static final protected Pattern LONG_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-/.*$"); + static final private Pattern SHORT_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-.+\\.xhtml$"); + static final private Pattern SHORT_REWRITED_URL_PARAMETERS = Pattern.compile("^[^-]+-(.+)\\.xhtml$"); + static final private Pattern LONG_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-/.*$"); // static final protected Pattern LONG_REWRITED_URL_PARAMETERS = // Pattern.compile("^.+-/(.)+*$"); - static final protected Pattern REWRITE_PARAMETER = Pattern.compile("[^%\\w\\d]"); + static final private Pattern REWRITE_PARAMETER = Pattern.compile("[^%\\w\\d]"); - protected String webclassesRootPath; + private String webclassesRootPath; /** * "Code can be shortest, speedest and memory smallest, but not the three in same time, only two" @@ -96,13 +96,21 @@ public class SimpleServletDispatcher extends HttpServlet // /* * In past, possibility to use the servlet path was enable. It is too - * complexe, not kiss mind. String path; if (request.getPathInfo() == - * null) { // web.xml url-pattern= *.xhtml path = - * request.getServletPath(); } else { // web.xml url-pattern = /* path = - * request.getPathInfo(); } + * complexe, not kiss mind. + * + * String path; + * if (request.getPathInfo() == null) + * { + * // web.xml url-pattern= *.xhtml + * path = request.getServletPath(); + * } + * else + * { + * // web.xml url-pattern = + * path = request.getPathInfo(); + * } */ - // String path = request.getRequestURI(); - String path = request.getPathInfo(); + String path = request.getRequestURI(); if ((!path.endsWith("/")) && (!path.endsWith(".xhtml")) && (!path.contains("-/"))) {