+{
+ private static final long serialVersionUID = -5400120588573116300L;
+
+ /**
+ *
+ */
+ public Catchers()
+ {
+ super();
+ }
+
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/FolderCatcher.java b/src/fr/devinsy/kiss4web/catchers/FolderCatcher.java
new file mode 100644
index 0000000..69c536c
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/FolderCatcher.java
@@ -0,0 +1,108 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.KissDispatcherUtils;
+import fr.devinsy.util.strings.StringList;
+
+/**
+ *
+ */
+public class FolderCatcher
+{
+ private static Logger logger = LoggerFactory.getLogger(FolderCatcher.class);
+
+ /**
+ * @throws IOException
+ * @throws ServletException
+ *
+ */
+ public static void doCatch(final ServletConfig servletConfig, final HttpServletRequest request, final HttpServletResponse response, final String webClassesRootPackage) throws IOException,
+ ServletException
+ {
+ logger.debug("Doing catch.");
+
+ String urlPath = request.getPathInfo();
+
+ String className;
+ String[] tokens = urlPath.split("/");
+ if (tokens.length == 1)
+ {
+ className = "Index_xhtml";
+ }
+ else
+ {
+ StringList buffer = new StringList();
+
+ // Note: as pathInfo starts always with a '/', the first
+ // good token index is 1.
+ for (int tokenCounter = 1; tokenCounter < tokens.length - 1; tokenCounter++)
+ {
+ buffer.append(tokens[tokenCounter]);
+ buffer.append('.');
+ }
+
+ String lastToken = tokens[tokens.length - 1];
+ buffer.append(StringUtils.capitalize(lastToken)).append("_xhtml");
+
+ className = buffer.toString();
+ }
+
+ className = KissDispatcherUtils.concatenatePackage(webClassesRootPackage, className);
+ logger.info("className=[" + className + "]");
+
+ KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, className);
+ }
+
+ /**
+ *
+ * @param urlPath
+ * @return
+ */
+ public static boolean matches(final HttpServletRequest request)
+ {
+ boolean result;
+
+ String urlPath = request.getPathInfo();
+
+ if ((urlPath != null) && (urlPath.endsWith("/")))
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+
+ //
+ return result;
+ }
+
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/LongURLCatcher.java b/src/fr/devinsy/kiss4web/catchers/LongURLCatcher.java
new file mode 100644
index 0000000..417c766
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/LongURLCatcher.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.KissDispatcherUtils;
+
+/**
+ *
+ */
+public class LongURLCatcher
+{
+ private static Logger logger = LoggerFactory.getLogger(LongURLCatcher.class);
+
+ /**
+ * @throws IOException
+ * @throws ServletException
+ *
+ */
+ public static void doCatch(final ServletConfig servletConfig, final HttpServletRequest request, final HttpServletResponse response, final String webClassesRootPackage) throws IOException,
+ ServletException
+ {
+ logger.debug("Doing catch.");
+
+ String urlPath = request.getPathInfo();
+
+ String rewritedURLPath = LongURLRewriter.unrewrite(urlPath);
+
+ String className = KissDispatcherUtils.concatenatePackage(webClassesRootPackage, rewritedURLPath);
+ logger.info("className=[" + className + "]");
+
+ KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, className);
+ }
+
+ /**
+ *
+ * @param urlPath
+ * @return
+ */
+ public static boolean matches(final HttpServletRequest request)
+ {
+ boolean result;
+
+ String urlPath = request.getPathInfo();
+
+ result = LongURLRewriter.matches(urlPath);
+
+ //
+ return result;
+ }
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/LongURLRewriter.java b/src/fr/devinsy/kiss4web/catchers/LongURLRewriter.java
new file mode 100644
index 0000000..3af80f5
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/LongURLRewriter.java
@@ -0,0 +1,167 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.util.strings.StringList;
+
+/**
+ *
+ */
+public class LongURLRewriter
+{
+ private static Logger logger = LoggerFactory.getLogger(LongURLRewriter.class);
+
+ private final static Pattern LONG_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-/.*$");
+ // static final protected Pattern LONG_REWRITED_URL_PARAMETERS =
+ // Pattern.compile("^.+-/(.)+*$");
+ private static final Pattern REWRITE_PARAMETER = Pattern.compile("[^%\\w\\d]");
+
+ /**
+ *
+ * @param urlPath
+ * @return
+ */
+ public static boolean matches(final String urlPath)
+ {
+ boolean result;
+
+ Matcher matcher = LONG_REWRITED_URL_CLASS.matcher(urlPath);
+
+ result = matcher.matches();
+
+ //
+ return result;
+ }
+
+ /**
+ *
+ */
+ public static String[] unrewriteParameters(final HttpServletRequest request)
+ {
+ String[] result;
+
+ result = unrewriteParameters(request.getRequestURI());
+
+ //
+ return result;
+ }
+
+ /**
+ * This method gives a way for a long rewriting URL format. Long as in REST.
+ *
+ * Sometimes, URL has to be rewrited because we need to put parameter in the
+ * page name.
+ *
+ * Example:
+ *
+ *
+ * "/good/give_file?id=123&filename=foo.jpg"
+ * => rewriteShorturl("/good/give_file", "123", "foo.jpg");
+ * => "/good/give_file-/123/foo.jpg"
+ *
+ *
+ * Note: "-/" is used to indicate the beginning of parameters.
+ *
+ */
+ public static String rewriteLongUrl(final String path, final String... parameters)
+ {
+ String result;
+
+ StringList string = new StringList();
+
+ string.append(path).append("-");
+ if ((parameters == null) || (parameters.length == 0))
+ {
+ string.append("/");
+ }
+ else
+ {
+ for (String parameter : parameters)
+ {
+ string.append("/").append(parameter);
+ }
+ }
+
+ result = string.toString();
+
+ //
+ return result;
+ }
+
+ /**
+ *
+ * /catalog/article-/123/2016/12/14/resume.xhtml -> /catalog/article.xhtml
+ *
+ * @param source
+ * an URL path.
+ * @return
+ */
+ public static String unrewrite(final String source)
+ {
+ String result;
+
+ Matcher matcher = LONG_REWRITED_URL_CLASS.matcher(source);
+ if (matcher.matches())
+ {
+ // Short rewrited URL case.
+ // logger.debug("group 1=[" + matcher.group(1) +
+ // "]");
+ result = matcher.group(1) + ".xhtml";
+ }
+ else
+ {
+ result = null;
+ }
+
+ //
+ return result;
+ }
+
+ /**
+ * Extract values from a path.
+ *
+ * Example:
+ *
+ *
+ * "/article-/123/doors/open.xhtml";
+ * => "123", "doors" and "open".
+ *
+ *
+ * @param source
+ * an URL path.
+ * @return
+ */
+ public static String[] unrewriteParameters(final String source)
+ {
+ String[] result;
+
+ result = source.substring(source.indexOf("-/") + 2).split("/");
+
+ //
+ return result;
+ }
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/RootCatcher.java b/src/fr/devinsy/kiss4web/catchers/RootCatcher.java
new file mode 100644
index 0000000..87f3201
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/RootCatcher.java
@@ -0,0 +1,79 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.KissDispatcherUtils;
+
+/**
+ *
+ */
+public class RootCatcher
+{
+ private static Logger logger = LoggerFactory.getLogger(RootCatcher.class);
+
+ /**
+ * @throws IOException
+ * @throws ServletException
+ *
+ */
+ public static void doCatch(final ServletConfig servletConfig, final HttpServletRequest request, final HttpServletResponse response, final String webClassesRootPackage) throws IOException,
+ ServletException
+ {
+ logger.debug("Doing catch.");
+
+ String className = KissDispatcherUtils.concatenatePackage(webClassesRootPackage, "Index_xhtml");
+
+ logger.info("classPathname=[" + className + "]");
+ KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, className);
+ }
+
+ /**
+ *
+ * @param urlPath
+ * @return
+ */
+ public static boolean matches(final HttpServletRequest request)
+ {
+ boolean result;
+
+ String urlPath = request.getPathInfo();
+
+ if ((urlPath != null) && (urlPath.equals("/")))
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+
+ //
+ return result;
+ }
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/ShortURLCatcher.java b/src/fr/devinsy/kiss4web/catchers/ShortURLCatcher.java
new file mode 100644
index 0000000..a0f55c9
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/ShortURLCatcher.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.KissDispatcherUtils;
+
+/**
+ *
+ */
+public class ShortURLCatcher
+{
+ private static Logger logger = LoggerFactory.getLogger(ShortURLCatcher.class);
+
+ /**
+ * @throws IOException
+ * @throws ServletException
+ *
+ */
+ public static void doCatch(final ServletConfig servletConfig, final HttpServletRequest request, final HttpServletResponse response, final String webClassesRootPackage) throws IOException,
+ ServletException
+ {
+ logger.debug("Doing catch.");
+
+ String urlPath = request.getPathInfo();
+
+ String rewritedURLPath = ShortURLRewriter.unrewrite(urlPath);
+
+ String className = KissDispatcherUtils.concatenatePackage(webClassesRootPackage, rewritedURLPath);
+ logger.info("className=[" + className + "]");
+
+ KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, className);
+ }
+
+ /**
+ *
+ * @param urlPath
+ * @return
+ */
+ public static boolean matches(final HttpServletRequest request)
+ {
+ boolean result;
+
+ String urlPath = request.getPathInfo();
+
+ result = ShortURLRewriter.matches(urlPath);
+
+ //
+ return result;
+ }
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/ShortURLRewriter.java b/src/fr/devinsy/kiss4web/catchers/ShortURLRewriter.java
new file mode 100644
index 0000000..770242d
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/ShortURLRewriter.java
@@ -0,0 +1,280 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.util.strings.StringList;
+
+/**
+ *
+ */
+public class ShortURLRewriter
+{
+ private static Logger logger = LoggerFactory.getLogger(ShortURLRewriter.class);
+
+ private static final Pattern SHORT_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-.+\\.xhtml$");
+ private static final Pattern SHORT_REWRITED_URL_PARAMETERS = Pattern.compile("^[^-]+-(.+)\\.xhtml$");
+
+ private static final Pattern REWRITE_PARAMETER = Pattern.compile("[^%\\w\\d]");
+
+ /*
+ * "Code can be shortest, speedest and memory smallest, but not the three in same time, only two", unknow citation.
+ *
+ * Note: characters array avalaible here
+ * http://fr.wikipedia.org/wiki/Table_des_caract%C3%A8res_Unicode_%280000-0FFF%29
+ */
+ private static char NONE = (char) 0;
+
+ private static int[] rewritingParameterMapping = {
+ /* 00 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+ /* 10 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+ /* 20 */'-', NONE, NONE, '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-',
+ /* 30 */'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '-', '-', '-', '-', '-',
+ /* 40 */'\u0040', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ /* 50 */'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '-', '-', '-', '-', '-',
+ /* 60 */'-', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E', '\u006F',
+ /* 70 */'\u0070', '\u0071', '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', '-', '-',
+ /* 80 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+ /* 90 */NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+ /* A0 */'\u00A0', '\u00A1', '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7', '\u00A8', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD', '\u00AE', '\u00AF',
+ /* B0 */'-', '\u00B1', '\u00B2', '\u00B3', '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9', '\u00BA', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00BF',
+ /* C0 */'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i',
+ /* D0 */'\u00D0', '\u00D1', 'o', 'o', 'o', 'o', 'o', 'o', '\u00D8', 'u', 'u', 'u', 'u', 'y', '\u00DE', '\u00DF',
+ /* E0 */'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i',
+ /* F0 */'o', 'n', 'o', 'o', 'o', 'o', 'o', '\u00F7', '-', 'u', 'u', 'u', 'u', 'y', '-', 'y' };
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ public static boolean matches(final String url)
+ {
+ boolean result;
+
+ Matcher matcher = SHORT_REWRITED_URL_CLASS.matcher(url);
+
+ result = matcher.matches();
+
+ //
+ return result;
+ }
+
+ /**
+ * This method gives a way for a short rewriting URL format.
+ *
+ * Sometimes, URL has to be rewrited because we need to put parameter in the
+ * page name.
+ *
+ * Example:
+ *
+ *
+ * "/good/article.xhtm?id=123&class=today&title=story's about me"
+ * => rewriteShorturl("/good/article", "xhtml", "123", "Story's aboute me");
+ * => "/good/article-123-today-story-s-about-me.xhtml"
+ *
+ */
+ public static String rewrite(final String uri, final String extension, final String... parameters)
+ {
+ String result;
+
+ StringList buffer = new StringList();
+
+ buffer.append(uri);
+
+ for (String parameter : parameters)
+ {
+ // Not use of String.replaceAll() method in goal to optimize Pattern
+ // compile action.
+ // string.append("-").append(REWRITE_PARAMETER.matcher(parameter.toLowerCase()).replaceAll("-"));
+ buffer.append("-").append(rewriteParameter(parameter));
+ }
+
+ if ((extension != null) && (extension.length() != 0))
+ {
+ buffer.append(".").append(extension);
+ }
+
+ result = buffer.toString();
+
+ //
+ return result;
+ }
+
+ /**
+ *
+ * @param parameter
+ * @return
+ */
+ public static String rewriteParameter(final String parameter)
+ {
+ String result;
+
+ StringBuffer buffer = new StringBuffer(parameter.length());
+
+ char previousCar = NONE;
+ for (int charIndex = 0; charIndex < parameter.length(); charIndex++)
+ {
+ // logger.info("" + charIndex + " " + parameter.charAt(charIndex) +
+ // " " + (char) tab[parameter.charAt(charIndex)]);
+
+ char sourceCar = parameter.charAt(charIndex);
+
+ char targetCar;
+ if (sourceCar > 255)
+ {
+ targetCar = '-';
+ }
+ else
+ {
+ targetCar = (char) rewritingParameterMapping[sourceCar];
+ }
+
+ if (targetCar != NONE)
+ {
+ if ((targetCar != '-') || ((targetCar == '-') && (previousCar != '-')))
+ {
+ buffer.append(targetCar);
+ previousCar = targetCar;
+ }
+ }
+ }
+
+ if (buffer.charAt(buffer.length() - 1) == '-')
+ {
+ buffer.setLength(buffer.length() - 1);
+ }
+
+ result = buffer.toString();
+ logger.info("[" + parameter + "] -> [" + result + "]");
+ //
+ return result;
+ }
+
+ /**
+ *
+ * article.xhtm?id=123 -> article.xhtml
+ *
+ * @param source
+ * @return
+ */
+ public static String unrewrite(final String source)
+ {
+ String result;
+
+ Matcher matcher = SHORT_REWRITED_URL_CLASS.matcher(source);
+ if (matcher.matches())
+ {
+ // Short rewrited URL case.
+ // logger.debug("group 1=[" + matcher.group(1) +
+ // "]");
+ result = matcher.group(1) + ".xhtml";
+ }
+ else
+ {
+ result = null;
+ }
+
+ //
+ return result;
+ }
+
+ /**
+ *
+ */
+ public static String unrewriteParameter(final HttpServletRequest request)
+ {
+ String result;
+
+ result = unrewriteParameter(request.getRequestURI());
+
+ //
+ return result;
+ }
+
+ /**
+ * Return value of the first parameter.
+ */
+ public static String unrewriteParameter(final String path)
+ {
+ String result;
+
+ String[] results = unrewriteParameters(path);
+
+ if ((results == null) || (results.length == 0))
+ {
+ result = null;
+ }
+ else
+ {
+ result = results[0];
+ }
+
+ //
+ return result;
+ }
+
+ /**
+ *
+ */
+ public static String[] unrewriteParameters(final HttpServletRequest request)
+ {
+ String[] result;
+
+ result = unrewriteParameters(request.getRequestURI());
+
+ //
+ return result;
+ }
+
+ /**
+ * Extract value from a path. Example: "/article-123.xhtml" => "123".
+ */
+ public static String[] unrewriteParameters(final String path)
+ {
+ String[] result;
+
+ Matcher matcher = SHORT_REWRITED_URL_PARAMETERS.matcher(path);
+ if (matcher.matches())
+ {
+ if (matcher.groupCount() != 1)
+ {
+ result = null;
+ }
+ else
+ {
+ result = matcher.group(1).split("-");
+ }
+ }
+ else
+ {
+ result = null;
+ }
+
+ //
+ return result;
+ }
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/WebContentCatcher.java b/src/fr/devinsy/kiss4web/catchers/WebContentCatcher.java
new file mode 100644
index 0000000..9da2a43
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/WebContentCatcher.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.KissDispatcherUtils;
+
+/**
+ *
+ */
+public class WebContentCatcher
+{
+ private static Logger logger = LoggerFactory.getLogger(WebContentCatcher.class);
+
+ /**
+ * @throws IOException
+ * @throws ServletException
+ *
+ */
+ public static void doCatch(final ServletContext servletContext, final HttpServletRequest request, final HttpServletResponse response, final String webClassesRootPackage) throws IOException,
+ ServletException
+ {
+ logger.debug("Doing catch.");
+
+ String path = servletContext.getRealPath("/") + request.getPathInfo();
+ logger.info("path=[{}]", path);
+
+ String mimeType = servletContext.getMimeType(path);
+ KissDispatcherUtils.returnInlineFile(response, new File(path), mimeType);
+
+ logger.info("File returned directly [{}] with mimetype [{}].", path, servletContext.getMimeType(path));
+ }
+
+ /**
+ *
+ * @param urlPath
+ * @return
+ */
+ public static boolean matches(final ServletContext servletContext, final HttpServletRequest request)
+ {
+ boolean result;
+
+ if (new File(servletContext.getRealPath("/") + request.getPathInfo()).exists())
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+
+ //
+ return result;
+ }
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/WebInfCatcher.java b/src/fr/devinsy/kiss4web/catchers/WebInfCatcher.java
new file mode 100644
index 0000000..2a397f1
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/WebInfCatcher.java
@@ -0,0 +1,82 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.KissDispatcherUtils;
+
+/**
+ *
+ */
+public class WebInfCatcher
+{
+ private static Logger logger = LoggerFactory.getLogger(WebInfCatcher.class);
+
+ /**
+ * @throws IOException
+ * @throws ServletException
+ *
+ */
+ public static void doCatch(final ServletContext servletContext, final HttpServletRequest request, final HttpServletResponse response, final String webClassesRootPackage) throws IOException,
+ ServletException
+ {
+ logger.debug("Doing catch.");
+
+ String path = servletContext.getRealPath("/") + "WEB-INF/classes/" + webClassesRootPackage.replaceAll("\\.", "/") + request.getPathInfo();
+
+ logger.info("path=[{}]", path);
+
+ String mimeType = servletContext.getMimeType(path);
+ KissDispatcherUtils.returnInlineFile(response, new File(path), mimeType);
+
+ logger.info("File returned directly [{}] with mimetype [{}].", path, servletContext.getMimeType(path));
+ }
+
+ /**
+ *
+ * @param urlPath
+ * @return
+ */
+ public static boolean matches(final ServletContext servletContext, final HttpServletRequest request, final String webClassesRootPackage)
+ {
+ boolean result;
+
+ if (new File(servletContext.getRealPath("/") + "WEB-INF/classes/" + webClassesRootPackage.replaceAll("\\.", "/") + request.getPathInfo()).exists())
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+
+ //
+ return result;
+ }
+}
diff --git a/src/fr/devinsy/kiss4web/catchers/XHTMLCatcher.java b/src/fr/devinsy/kiss4web/catchers/XHTMLCatcher.java
new file mode 100644
index 0000000..53c3987
--- /dev/null
+++ b/src/fr/devinsy/kiss4web/catchers/XHTMLCatcher.java
@@ -0,0 +1,106 @@
+/**
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.KissDispatcherUtils;
+import fr.devinsy.util.strings.StringList;
+
+/**
+ *
+ */
+public class XHTMLCatcher
+{
+ private static Logger logger = LoggerFactory.getLogger(XHTMLCatcher.class);
+
+ /**
+ * @throws IOException
+ * @throws ServletException
+ */
+ public static void doCatch(final ServletConfig servletConfig, final HttpServletRequest request, final HttpServletResponse response, final String webClassesRootPackage) throws IOException,
+ ServletException
+ {
+ logger.debug("Doing catch.");
+
+ String urlPath = request.getPathInfo();
+
+ String className;
+ String[] tokens = urlPath.split("/");
+ if (tokens.length == 1)
+ {
+ className = "Index_xhtml";
+ }
+ else
+ {
+ StringList buffer = new StringList();
+
+ // Note: as pathInfo starts always with a '/', the first
+ // good token index is 1.
+ for (int tokenCounter = 1; tokenCounter < tokens.length - 1; tokenCounter++)
+ {
+ buffer.append(tokens[tokenCounter]);
+ buffer.append('.');
+ }
+
+ String lastToken = tokens[tokens.length - 1];
+ buffer.append(StringUtils.capitalize(lastToken).replace('.', '_')).append("_xhtml");
+
+ className = buffer.toString();
+ }
+
+ className = KissDispatcherUtils.concatenatePackage(webClassesRootPackage, className);
+ logger.info("className=[" + className + "]");
+
+ KissDispatcherUtils.dispatchToServlet(servletConfig, request, response, className);
+ }
+
+ /**
+ *
+ * @param urlPath
+ * @return
+ */
+ public static boolean matches(final HttpServletRequest request)
+ {
+ boolean result;
+
+ String urlPath = request.getPathInfo();
+
+ if ((urlPath != null) && (urlPath.endsWith(".xhtml")))
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+
+ //
+ return result;
+ }
+}
diff --git a/test/FooSandbox.java b/test/FooSandbox.java
index fa3e9dc..259bdef 100644
--- a/test/FooSandbox.java
+++ b/test/FooSandbox.java
@@ -1,30 +1,29 @@
/**
- * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Kiss4web.
*
* Kiss4web is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
+ * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Kiss4web is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see
*/
-import fr.devinsy.kiss4web.KissDispatcher;
-import fr.devinsy.kiss4web.ServletDispatcher;
+import fr.devinsy.kiss4web.KissDispatcherUtils;
/**
* Kiss4Web tests.
*/
class FooSandbox
{
- static private org.apache.log4j.Logger logger;
+ private static org.apache.log4j.Logger logger;
static
{
@@ -91,7 +90,7 @@ class FooSandbox
{
String result;
- result = "[" + pathInfo + "]=>[" + KissDispatcher.pathInfoToClassName(pathInfo, prefix) + "]";
+ result = "[" + pathInfo + "]=>[" + KissDispatcherUtils.pathInfoToClassName(pathInfo, prefix) + "]";
//
return (result);
diff --git a/test/fr/devinsy/kiss4web/catchers/BlankCatcherTest.java b/test/fr/devinsy/kiss4web/catchers/BlankCatcherTest.java
new file mode 100644
index 0000000..1f4b2f1
--- /dev/null
+++ b/test/fr/devinsy/kiss4web/catchers/BlankCatcherTest.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright (C) 2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.mocks.HttpServletRequestMock;
+
+/**
+ *
+ * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
+ */
+public class BlankCatcherTest
+{
+ private static Logger logger = LoggerFactory.getLogger(ShortURLCatcher.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMatches01()
+ {
+ HttpServletRequestMock source = new HttpServletRequestMock();
+ source.setPathInfo(null);
+
+ Assert.assertTrue(BlankCatcher.matches(source));
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testMatches02()
+ {
+ HttpServletRequestMock source = new HttpServletRequestMock();
+ source.setPathInfo("");
+
+ Assert.assertTrue(BlankCatcher.matches(source));
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testMatches03()
+ {
+ HttpServletRequestMock source = new HttpServletRequestMock();
+ source.setPathInfo("/");
+
+ Assert.assertFalse(BlankCatcher.matches(source));
+ }
+}
diff --git a/test/fr/devinsy/kiss4web/catchers/RootCatcherTest.java b/test/fr/devinsy/kiss4web/catchers/RootCatcherTest.java
new file mode 100644
index 0000000..fdc8fe7
--- /dev/null
+++ b/test/fr/devinsy/kiss4web/catchers/RootCatcherTest.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (C) 2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+package fr.devinsy.kiss4web.catchers;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.mocks.HttpServletRequestMock;
+
+/**
+ *
+ * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
+ */
+public class RootCatcherTest
+{
+ private static Logger logger = LoggerFactory.getLogger(ShortURLCatcher.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMatches01()
+ {
+ HttpServletRequestMock source = new HttpServletRequestMock();
+ source.setPathInfo(null);
+
+ Assert.assertFalse(RootCatcher.matches(source));
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testMatches02()
+ {
+ HttpServletRequestMock source = new HttpServletRequestMock();
+ source.setPathInfo("");
+
+ Assert.assertFalse(RootCatcher.matches(source));
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testMatches03()
+ {
+ HttpServletRequestMock source = new HttpServletRequestMock();
+ source.setPathInfo("/");
+
+ Assert.assertTrue(RootCatcher.matches(source));
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testMatches04()
+ {
+ HttpServletRequestMock source = new HttpServletRequestMock();
+ source.setPathInfo("/toto");
+
+ Assert.assertFalse(RootCatcher.matches(source));
+ }
+}
diff --git a/test/fr/devinsy/kiss4web/mocks/HttpServletRequestMock.java b/test/fr/devinsy/kiss4web/mocks/HttpServletRequestMock.java
new file mode 100644
index 0000000..e6aa94f
--- /dev/null
+++ b/test/fr/devinsy/kiss4web/mocks/HttpServletRequestMock.java
@@ -0,0 +1,432 @@
+package fr.devinsy.kiss4web.mocks;
+/**
+ * Copyright (C) 2016 Christian Pierre MOMON
+ *
+ * This file is part of Kiss4web.
+ *
+ * Kiss4web is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Kiss4web is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Kiss4web. If not, see
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.catchers.ShortURLCatcher;
+
+/**
+ *
+ * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
+ */
+public class HttpServletRequestMock implements HttpServletRequest
+{
+ private static Logger logger = LoggerFactory.getLogger(ShortURLCatcher.class);
+
+ private String pathInfo;
+
+ @Override
+ public Object getAttribute(final String name)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getAuthType()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getContentLength()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getContentType()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Cookie[] getCookies()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getDateHeader(final String name)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getHeader(final String name)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getHeaderNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getHeaders(final String name)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getIntHeader(final String name)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getLocalAddr()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getLocales()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getLocalName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getLocalPort()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getMethod()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getParameter(final String name)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map getParameterMap()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getParameterNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String[] getParameterValues(final String name)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getPathInfo()
+ {
+ return this.pathInfo;
+ }
+
+ @Override
+ public String getPathTranslated()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getProtocol()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getQueryString()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRealPath(final String path)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRemoteHost()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getRemotePort()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getRemoteUser()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(final String path)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRequestedSessionId()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRequestURI()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public StringBuffer getRequestURL()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getScheme()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServerName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getServerPort()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getServletPath()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession(final boolean create)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdValid()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isSecure()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isUserInRole(final String role)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void removeAttribute(final String name)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAttribute(final String name, final Object o)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setCharacterEncoding(final String env) throws UnsupportedEncodingException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPathInfo(final String pathInfo)
+ {
+ this.pathInfo = pathInfo;
+ }
+
+}
diff --git a/test/one/Foo2Test.java b/test/one/Foo2Test.java
deleted file mode 100644
index b5b6bc0..0000000
--- a/test/one/Foo2Test.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Kiss4web is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Kiss4web is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Kiss4web. If not, see
- */
-package one;
-
-import org.junit.Test;
-
-public class Foo2Test
-{
- // private Logger logger =
- // LoggerFactory.getLogger(PdfGenerationAmqpServiceInjectedTest.class);
-
- /**
- *
- */
- @Test
- public void test2a()
- {
- // logger.debug("===== test starting...");
-
- // logger.debug("===== test done.");
- }
-
-}