diff --git a/.classpath b/.classpath index f142b09..792112e 100644 --- a/.classpath +++ b/.classpath @@ -2,7 +2,7 @@ - + diff --git a/.settings/com.wdev91.eclipse.copyright.xml b/.settings/com.wdev91.eclipse.copyright.xml new file mode 100644 index 0000000..cb34e92 --- /dev/null +++ b/.settings/com.wdev91.eclipse.copyright.xml @@ -0,0 +1,59 @@ + + + + ]]> +
+
+
+
+
+
+
+ + + ]]> + ]]> +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+ + + +
+ diff --git a/src/fr/devinsy/kiss4web/CookieHelper.java b/src/fr/devinsy/kiss4web/CookieHelper.java index 24b5269..55e008f 100644 --- a/src/fr/devinsy/kiss4web/CookieHelper.java +++ b/src/fr/devinsy/kiss4web/CookieHelper.java @@ -1,5 +1,22 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web; - import java.io.UnsupportedEncodingException; import javax.servlet.http.Cookie; @@ -9,6 +26,7 @@ import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + /** * */ @@ -202,4 +220,4 @@ public class CookieHelper { response.addCookie(buildCookie(name, value, duration)); } -} \ No newline at end of file +} diff --git a/src/fr/devinsy/kiss4web/FileItemHelper.java b/src/fr/devinsy/kiss4web/FileItemHelper.java index 0c930c5..5e9aaf1 100644 --- a/src/fr/devinsy/kiss4web/FileItemHelper.java +++ b/src/fr/devinsy/kiss4web/FileItemHelper.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web; import java.util.List; diff --git a/src/fr/devinsy/kiss4web/Page.java b/src/fr/devinsy/kiss4web/Page.java index 6098519..f46ada0 100644 --- a/src/fr/devinsy/kiss4web/Page.java +++ b/src/fr/devinsy/kiss4web/Page.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web; import java.io.IOException; diff --git a/src/fr/devinsy/kiss4web/PageManager.java b/src/fr/devinsy/kiss4web/PageManager.java index dc9c973..61103d4 100644 --- a/src/fr/devinsy/kiss4web/PageManager.java +++ b/src/fr/devinsy/kiss4web/PageManager.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web; import java.io.IOException; @@ -242,17 +260,17 @@ public class PageManager extends HttpServlet char charSource = source[nChar]; switch (charSource) { - case '/': - target[nChar - 1] = '.'; - lastStartToken = nChar; + case '/': + target[nChar - 1] = '.'; + lastStartToken = nChar; break; - case '.': - target[lastStartToken] = Character.toUpperCase(target[lastStartToken]); + case '.': + target[lastStartToken] = Character.toUpperCase(target[lastStartToken]); break; - default: - target[nChar - 1] = source[nChar]; + default: + target[nChar - 1] = source[nChar]; } } @@ -287,13 +305,13 @@ public class PageManager extends HttpServlet char charSource = source[nChar]; switch (charSource) { - case '/': - target[nChar - 1] = '.'; - lastStartToken = nChar + 1; + case '/': + target[nChar - 1] = '.'; + lastStartToken = nChar + 1; break; - default: - target[nChar - 1] = source[nChar]; + default: + target[nChar - 1] = source[nChar]; } } diff --git a/src/fr/devinsy/kiss4web/Redirector.java b/src/fr/devinsy/kiss4web/Redirector.java index 0ba3720..2b3da24 100644 --- a/src/fr/devinsy/kiss4web/Redirector.java +++ b/src/fr/devinsy/kiss4web/Redirector.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web; import javax.servlet.http.HttpServletResponse; diff --git a/src/fr/devinsy/kiss4web/ServletDispatcher.java b/src/fr/devinsy/kiss4web/ServletDispatcher.java index 161dfbb..28fc46d 100755 --- a/src/fr/devinsy/kiss4web/ServletDispatcher.java +++ b/src/fr/devinsy/kiss4web/ServletDispatcher.java @@ -1,9 +1,21 @@ /** - * @author Christian Momon, June 2008. - * This file is free software under the terms of the GNU Library General Public License - * as published by the Free Software Foundation version 2 or any later version. + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see */ - package fr.devinsy.kiss4web; import java.io.IOException; diff --git a/src/fr/devinsy/kiss4web/ServletTools.java b/src/fr/devinsy/kiss4web/ServletTools.java index 1f75f92..cbb0922 100644 --- a/src/fr/devinsy/kiss4web/ServletTools.java +++ b/src/fr/devinsy/kiss4web/ServletTools.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web; import java.util.Enumeration; diff --git a/src/fr/devinsy/kiss4web/SimpleSecurityAgent.java b/src/fr/devinsy/kiss4web/SimpleSecurityAgent.java index 05108dc..4d19219 100644 --- a/src/fr/devinsy/kiss4web/SimpleSecurityAgent.java +++ b/src/fr/devinsy/kiss4web/SimpleSecurityAgent.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web; import javax.servlet.http.HttpServletRequest; diff --git a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java index faef36a..37ae9cf 100755 --- a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java +++ b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java @@ -1,9 +1,21 @@ /** - * @author Christian Momon, June 2008. This file is free software under the - * terms of the GNU Library General Public License as published by the - * Free Software Foundation version 2 or any later version. + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see */ - package fr.devinsy.kiss4web; import java.io.File; @@ -26,7 +38,7 @@ import org.slf4j.LoggerFactory; import fr.devinsy.util.StringList; /** - * + * Rename KissDispatcher? */ public class SimpleServletDispatcher extends HttpServlet { @@ -49,13 +61,11 @@ public class SimpleServletDispatcher extends HttpServlet private String webclassesRootPath; - /** - * "Code can be shortest, speedest and memory smallest, but not the three in same time, only two" - * , unknow citation. + /* + * "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 + * http://fr.wikipedia.org/wiki/Table_des_caract%C3%A8res_Unicode_%280000-0FFF%29 */ static protected char NONE = (char) 0; @@ -110,6 +120,38 @@ public class SimpleServletDispatcher extends HttpServlet * // web.xml url-pattern = * path = request.getPathInfo(); * } + * + * https://issues.apache.org/bugzilla/show_bug.cgi?id=11318 + * A number of features have been introduced in later versions of Tomcat + * that relate to URI encoding. This includes a URIEncoding attribute + * on the Coyote HTTP/1.1 connector which defaults to ISO-8859-1. + * + * According to the servlet specification: + * HttpServletRequest.getPathInfo() should be decoded by the web container; + * HttpServletRequest.getRequestURI() should not be decoded by the web container. + * + * + * http://stackoverflow.com/questions/15278512/safe-html-form-accept-charset/15587140#15587140 + * The standard URL encoding must use UTF-8 yet servlets not only default to ISO-8859-1 but don't offer + * any way to change that with code. + * Sure you can req.setRequestEncoding("UTF-8") before you read anything, but for some ungodly reason this only affects request body, + * not query string parameters. There is nothing in the servlet request interface to specify the encoding used for query string parameters. + * Using ISO-8859-1 in your form is a hack. Using this ancient encoding will cause more problems than solve for sure. + * Especially since browsers do not support ISO-8859-1 and always treat it as Windows-1252. Whereas servlets treat ISO-8859-1 as ISO-8859-1, + * so you will be screwed beyond belief if you go with this. + * To change this in Tomcat for example, you can use the URIEncoding attribute in your element: + * + * + * If you don't use a container that has these settings, can't change its settings or some other issue, + * you can still make it work because ISO-8859-1 decoding retains full information from the original binary. + * String correct = new String(request.getParameter("test").getBytes("ISO-8859-1"), "UTF-8") + * + * + * http://tomcat.apache.org/tomcat-5.5-doc/config/http.html + * URIEncoding + * This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. + * If not specified, ISO-8859-1 will be used. + * */ // String path = request.getRequestURI(); String path = request.getPathInfo(); diff --git a/src/fr/devinsy/kiss4web/security/Group.java b/src/fr/devinsy/kiss4web/security/Group.java index 620b100..807ef99 100644 --- a/src/fr/devinsy/kiss4web/security/Group.java +++ b/src/fr/devinsy/kiss4web/security/Group.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web.security; import java.util.Vector; diff --git a/src/fr/devinsy/kiss4web/security/Groups.java b/src/fr/devinsy/kiss4web/security/Groups.java index b5fba2a..d2dd2c9 100644 --- a/src/fr/devinsy/kiss4web/security/Groups.java +++ b/src/fr/devinsy/kiss4web/security/Groups.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web.security; import java.util.Iterator; diff --git a/src/fr/devinsy/kiss4web/security/GroupsFileReader.java b/src/fr/devinsy/kiss4web/security/GroupsFileReader.java index 45ec7e2..fe0febb 100644 --- a/src/fr/devinsy/kiss4web/security/GroupsFileReader.java +++ b/src/fr/devinsy/kiss4web/security/GroupsFileReader.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web.security; import java.io.FileInputStream; diff --git a/src/fr/devinsy/kiss4web/security/User.java b/src/fr/devinsy/kiss4web/security/User.java index 450aecd..f3f8951 100644 --- a/src/fr/devinsy/kiss4web/security/User.java +++ b/src/fr/devinsy/kiss4web/security/User.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web.security; /** diff --git a/src/fr/devinsy/kiss4web/security/Users.java b/src/fr/devinsy/kiss4web/security/Users.java index c42e30c..47a60db 100644 --- a/src/fr/devinsy/kiss4web/security/Users.java +++ b/src/fr/devinsy/kiss4web/security/Users.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web.security; import java.util.Iterator; diff --git a/src/fr/devinsy/kiss4web/security/UsersFileReader.java b/src/fr/devinsy/kiss4web/security/UsersFileReader.java index cc77cce..92e7c3a 100644 --- a/src/fr/devinsy/kiss4web/security/UsersFileReader.java +++ b/src/fr/devinsy/kiss4web/security/UsersFileReader.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package fr.devinsy.kiss4web.security; import java.io.FileInputStream; diff --git a/test/FooSandbox.java b/test/FooSandbox.java index b78de4d..f9bf9f7 100644 --- a/test/FooSandbox.java +++ b/test/FooSandbox.java @@ -1,11 +1,25 @@ /** - * Kiss4Web tests. + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see */ - import fr.devinsy.kiss4web.ServletDispatcher; /** - * + * Kiss4Web tests. */ class FooSandbox { diff --git a/test/one/Foo2Test.java b/test/one/Foo2Test.java index 0b98fdf..c024785 100644 --- a/test/one/Foo2Test.java +++ b/test/one/Foo2Test.java @@ -1,3 +1,21 @@ +/** + * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * + * This file is part of Devinsy-utils. + * + * Devinsy-utils 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. + * + * Devinsy-utils 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 Devinsy-utils. If not, see + */ package one; import org.junit.Test;