diff --git a/.classpath b/.classpath
index 76aa084..603df75 100644
--- a/.classpath
+++ b/.classpath
@@ -2,28 +2,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 6aaec92..dfcf8f4 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,14 +1,18 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
@@ -30,7 +34,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assertion_message=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
@@ -161,7 +164,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
@@ -235,7 +237,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
@@ -395,7 +396,6 @@ org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
index fd68f7e..0b0ce7a 100644
--- a/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,7 +1,8 @@
+
-
+
diff --git a/lib/README b/lib/README
index d8d0324..f36c0e6 100644
--- a/lib/README
+++ b/lib/README
@@ -1,11 +1,17 @@
-Description of used libraries:
+== Description of used libraries.
+
+Various:
- commons-codec: digest tools.
- commons-fileupload:
- commons-io:
- devinsy-utils: util tools
+- servlet-api: servlet API
+
+Log libs:
+- log4j: log API
+- slf4j-api: facade log API
+- slf4j-log4j12: adaptation layer between slf4j and log4j
+
+UnitTest libs:
- hamcrest-core: required by junit
- junit: unit tests API
-- log4j: log API
-- servlet-api: servlet API
-- slf4j-api: facade log API
-- slf4j-log4j12: adaptation layer between slf4j and log4j
\ No newline at end of file
diff --git a/lib/UnitTesting/junit-4.11-sources.jar b/lib/UnitTesting/junit-4.11-sources.jar
deleted file mode 100644
index bab4cdd..0000000
Binary files a/lib/UnitTesting/junit-4.11-sources.jar and /dev/null differ
diff --git a/lib/UnitTesting/junit-4.11.jar b/lib/UnitTesting/junit-4.11.jar
deleted file mode 100644
index aaf7444..0000000
Binary files a/lib/UnitTesting/junit-4.11.jar and /dev/null differ
diff --git a/lib/UnitTesting/junit-4.12-sources.jar b/lib/UnitTesting/junit-4.12-sources.jar
new file mode 100644
index 0000000..884f92f
Binary files /dev/null and b/lib/UnitTesting/junit-4.12-sources.jar differ
diff --git a/lib/UnitTesting/junit-4.12.jar b/lib/UnitTesting/junit-4.12.jar
new file mode 100644
index 0000000..3a7fc26
Binary files /dev/null and b/lib/UnitTesting/junit-4.12.jar differ
diff --git a/lib/commons-io-2.7-sources.jar b/lib/commons-io-2.7-sources.jar
new file mode 100644
index 0000000..d019235
Binary files /dev/null and b/lib/commons-io-2.7-sources.jar differ
diff --git a/lib/commons-io-2.7.jar b/lib/commons-io-2.7.jar
new file mode 100644
index 0000000..5889458
Binary files /dev/null and b/lib/commons-io-2.7.jar differ
diff --git a/lib/commons-lang3-3.11-sources.jar b/lib/commons-lang3-3.11-sources.jar
new file mode 100644
index 0000000..68cad64
Binary files /dev/null and b/lib/commons-lang3-3.11-sources.jar differ
diff --git a/lib/commons-lang3-3.11.jar b/lib/commons-lang3-3.11.jar
new file mode 100644
index 0000000..bbaa8a6
Binary files /dev/null and b/lib/commons-lang3-3.11.jar differ
diff --git a/lib/commons-text-1.9-sources.jar b/lib/commons-text-1.9-sources.jar
new file mode 100644
index 0000000..a636e92
Binary files /dev/null and b/lib/commons-text-1.9-sources.jar differ
diff --git a/lib/commons-text-1.9.jar b/lib/commons-text-1.9.jar
new file mode 100644
index 0000000..cc0c690
Binary files /dev/null and b/lib/commons-text-1.9.jar differ
diff --git a/lib/devinsy-strings-0.11.4-sources.zip b/lib/devinsy-strings-0.11.4-sources.zip
new file mode 100644
index 0000000..d56e8cf
Binary files /dev/null and b/lib/devinsy-strings-0.11.4-sources.zip differ
diff --git a/lib/devinsy-strings-0.11.4.jar b/lib/devinsy-strings-0.11.4.jar
new file mode 100644
index 0000000..c0b03c0
Binary files /dev/null and b/lib/devinsy-strings-0.11.4.jar differ
diff --git a/lib/devinsy-utils-0.3.2-sources.zip b/lib/devinsy-utils-0.3.2-sources.zip
deleted file mode 100644
index 6eb22ba..0000000
Binary files a/lib/devinsy-utils-0.3.2-sources.zip and /dev/null differ
diff --git a/lib/devinsy-utils-0.3.2.jar b/lib/devinsy-utils-0.3.2.jar
deleted file mode 100644
index 05bb35d..0000000
Binary files a/lib/devinsy-utils-0.3.2.jar and /dev/null differ
diff --git a/lib/devinsy-xml-0.11.0-sources.zip b/lib/devinsy-xml-0.11.0-sources.zip
new file mode 100644
index 0000000..d1ee0e9
Binary files /dev/null and b/lib/devinsy-xml-0.11.0-sources.zip differ
diff --git a/lib/devinsy-xml-0.11.0.jar b/lib/devinsy-xml-0.11.0.jar
new file mode 100644
index 0000000..bec877c
Binary files /dev/null and b/lib/devinsy-xml-0.11.0.jar differ
diff --git a/lib/tomcat9-servlet-api-9.0.31-sources.jar b/lib/tomcat9-servlet-api-9.0.31-sources.jar
new file mode 100644
index 0000000..2fc724b
Binary files /dev/null and b/lib/tomcat9-servlet-api-9.0.31-sources.jar differ
diff --git a/lib/tomcat9-servlet-api-9.0.31.jar b/lib/tomcat9-servlet-api-9.0.31.jar
new file mode 100644
index 0000000..01e422e
Binary files /dev/null and b/lib/tomcat9-servlet-api-9.0.31.jar differ
diff --git a/lib/xidyn-1.11.2-sources.zip b/lib/xidyn-1.11.2-sources.zip
new file mode 100644
index 0000000..00d1097
Binary files /dev/null and b/lib/xidyn-1.11.2-sources.zip differ
diff --git a/lib/xidyn-1.11.2.jar b/lib/xidyn-1.11.2.jar
new file mode 100644
index 0000000..bd7e91b
Binary files /dev/null and b/lib/xidyn-1.11.2.jar differ
diff --git a/test/FooSandbox.java b/test/FooSandbox.java
index d28effb..b6b061b 100644
--- a/test/FooSandbox.java
+++ b/test/FooSandbox.java
@@ -1,3 +1,4 @@
+
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
*
@@ -50,8 +51,8 @@ public class FooSandbox
}
/**
- *
- */
+ *
+ */
public static String check(final String title, final StringBuffer source, final String model)
{
String result;
@@ -71,8 +72,8 @@ public class FooSandbox
}
/**
- *
- */
+ *
+ */
public static void main(final String[] args)
{
System.out.println("----------------------------");
@@ -84,8 +85,8 @@ public class FooSandbox
}
/**
- *
- */
+ *
+ */
public static String testCaller(final String pathInfo, final String prefix)
{
String result;
diff --git a/test/fr/devinsy/kiss4web/catchers/BlankCatcherTest.java b/test/fr/devinsy/kiss4web/catchers/BlankCatcherTest.java
index 6221578..5e1b587 100644
--- a/test/fr/devinsy/kiss4web/catchers/BlankCatcherTest.java
+++ b/test/fr/devinsy/kiss4web/catchers/BlankCatcherTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2016 Christian Pierre MOMON
+ * Copyright (C) 2016-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@@ -28,8 +28,7 @@ import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
import fr.devinsy.kiss4web.mocks.HttpServletRequestMock;
/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
+ * The Class BlankCatcherTest.
*/
public class BlankCatcherTest
{
@@ -44,7 +43,7 @@ public class BlankCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo(null);
- Assert.assertTrue(BlankHook.matches(source));
+ Assert.assertTrue(new BlankHook().matches(null, source));
}
/**
@@ -56,7 +55,7 @@ public class BlankCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("");
- Assert.assertTrue(BlankHook.matches(source));
+ Assert.assertTrue(new BlankHook().matches(null, source));
}
/**
@@ -68,6 +67,6 @@ public class BlankCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("/");
- Assert.assertFalse(BlankHook.matches(source));
+ Assert.assertFalse(new BlankHook().matches(null, source));
}
}
diff --git a/test/fr/devinsy/kiss4web/catchers/RootCatcherTest.java b/test/fr/devinsy/kiss4web/catchers/RootCatcherTest.java
index 768262d..257654c 100644
--- a/test/fr/devinsy/kiss4web/catchers/RootCatcherTest.java
+++ b/test/fr/devinsy/kiss4web/catchers/RootCatcherTest.java
@@ -44,7 +44,7 @@ public class RootCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo(null);
- Assert.assertFalse(RootHook.matches(source));
+ Assert.assertFalse(new RootHook().matches(null, source));
}
/**
@@ -56,7 +56,7 @@ public class RootCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("");
- Assert.assertFalse(RootHook.matches(source));
+ Assert.assertFalse(new RootHook().matches(null, source));
}
/**
@@ -68,7 +68,7 @@ public class RootCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("/");
- Assert.assertTrue(RootHook.matches(source));
+ Assert.assertTrue(new RootHook().matches(null, source));
}
/**
@@ -80,6 +80,6 @@ public class RootCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("/toto");
- Assert.assertFalse(RootHook.matches(source));
+ Assert.assertFalse(new RootHook().matches(null, source));
}
}
diff --git a/test/fr/devinsy/kiss4web/dispatcher/DispatcherFactoryTest.java b/test/fr/devinsy/kiss4web/dispatcher/DispatcherFactoryTest.java
new file mode 100644
index 0000000..0cd5d40
--- /dev/null
+++ b/test/fr/devinsy/kiss4web/dispatcher/DispatcherFactoryTest.java
@@ -0,0 +1,100 @@
+/**
+ * Copyright (C) 2021 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.dispatcher;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
+
+/**
+ * The Class DispatcherFactoryTest.
+ */
+public class DispatcherFactoryTest
+{
+ private static Logger logger = LoggerFactory.getLogger(ShortURLHook.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testTranslateToClassName01()
+ {
+ String source = "/";
+ String target = KissDispatcherFactory.translateToClassName(source);
+ Assert.assertEquals("IndexXhtml", target);
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testTranslateToClassName02()
+ {
+ String source = "/foo";
+ String target = KissDispatcherFactory.translateToClassName(source);
+ Assert.assertEquals("Foo", target);
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testTranslateToClassName03()
+ {
+ String source = "/foo.xhtml";
+ String target = KissDispatcherFactory.translateToClassName(source);
+ Assert.assertEquals("FooXhtml", target);
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testTranslateToClassName04()
+ {
+ String source = "/foo/bar.xhtml";
+ String target = KissDispatcherFactory.translateToClassName(source);
+ Assert.assertEquals("foo.BarXhtml", target);
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testTranslateToClassName05()
+ {
+ String source = "/fooBarBaz/fooBarBaz.xhtml";
+ String target = KissDispatcherFactory.translateToClassName(source);
+ Assert.assertEquals("fooBarBaz.FooBarBazXhtml", target);
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testTranslateToClassName06()
+ {
+ String source = "/foo_bar-baz/foo_bar-baz.xhtml";
+ String target = KissDispatcherFactory.translateToClassName(source);
+ Assert.assertEquals("foo_bar-baz.FooBarBazXhtml", target);
+ }
+}
diff --git a/test/fr/devinsy/kiss4web/mocks/HttpServletRequestMock.java b/test/fr/devinsy/kiss4web/mocks/HttpServletRequestMock.java
index 11fbb28..879d735 100644
--- a/test/fr/devinsy/kiss4web/mocks/HttpServletRequestMock.java
+++ b/test/fr/devinsy/kiss4web/mocks/HttpServletRequestMock.java
@@ -1,6 +1,7 @@
package fr.devinsy.kiss4web.mocks;
+
/**
- * Copyright (C) 2016 Christian Pierre MOMON
+ * Copyright (C) 2016-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@@ -39,6 +40,7 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpUpgradeHandler;
import javax.servlet.http.Part;
import org.slf4j.Logger;
@@ -47,8 +49,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
+ * The Class HttpServletRequestMock.
*/
public class HttpServletRequestMock implements HttpServletRequest
{
@@ -56,6 +57,27 @@ public class HttpServletRequestMock implements HttpServletRequest
private String pathInfo;
+ @Override
+ public boolean authenticate(final HttpServletResponse arg0) throws IOException, ServletException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String changeSessionId()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public AsyncContext getAsyncContext()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
@Override
public Object getAttribute(final String name)
{
@@ -91,6 +113,13 @@ public class HttpServletRequestMock implements HttpServletRequest
return 0;
}
+ @Override
+ public long getContentLengthLong()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
@Override
public String getContentType()
{
@@ -119,6 +148,13 @@ public class HttpServletRequestMock implements HttpServletRequest
return 0;
}
+ @Override
+ public DispatcherType getDispatcherType()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
@Override
public String getHeader(final String name)
{
@@ -224,6 +260,20 @@ public class HttpServletRequestMock implements HttpServletRequest
return null;
}
+ @Override
+ public Part getPart(final String arg0) throws IOException, IllegalStateException, ServletException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection getParts() throws IOException, IllegalStateException, ServletException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
@Override
public String getPathInfo()
{
@@ -342,6 +392,13 @@ public class HttpServletRequestMock implements HttpServletRequest
return 0;
}
+ @Override
+ public ServletContext getServletContext()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
@Override
public String getServletPath()
{
@@ -370,6 +427,20 @@ public class HttpServletRequestMock implements HttpServletRequest
return null;
}
+ @Override
+ public boolean isAsyncStarted()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isAsyncSupported()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
@Override
public boolean isRequestedSessionIdFromCookie()
{
@@ -412,6 +483,20 @@ public class HttpServletRequestMock implements HttpServletRequest
return false;
}
+ @Override
+ public void login(final String arg0, final String arg1) throws ServletException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void logout() throws ServletException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
@Override
public void removeAttribute(final String name)
{
@@ -438,41 +523,6 @@ public class HttpServletRequestMock implements HttpServletRequest
this.pathInfo = pathInfo;
}
- @Override
- public AsyncContext getAsyncContext()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public DispatcherType getDispatcherType()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public ServletContext getServletContext()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isAsyncStarted()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isAsyncSupported()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
@Override
public AsyncContext startAsync()
{
@@ -481,45 +531,16 @@ public class HttpServletRequestMock implements HttpServletRequest
}
@Override
- public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1)
+ public AsyncContext startAsync(final ServletRequest arg0, final ServletResponse arg1)
{
// TODO Auto-generated method stub
return null;
}
@Override
- public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public Part getPart(String arg0) throws IOException, IllegalStateException, ServletException
+ public T upgrade(final Class arg0) throws IOException, ServletException
{
// TODO Auto-generated method stub
return null;
}
-
- @Override
- public Collection getParts() throws IOException, IllegalStateException, ServletException
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void login(String arg0, String arg1) throws ServletException
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void logout() throws ServletException
- {
- // TODO Auto-generated method stub
-
- }
-
}