Updated headers. Made code review. Improved code design.
This commit is contained in:
parent
5003530064
commit
90a8d57df4
18 changed files with 142 additions and 386 deletions
|
@ -20,7 +20,7 @@ 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_binary_expression=16
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
formatter_profile=_Devinsy
|
|
||||||
formatter_settings_version=12
|
formatter_settings_version=12
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
|
* Copyright (C) 2013-2016 Christian Pierre MOMON
|
||||||
|
* Copyright (C) 2006-2010 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
|
@ -26,7 +28,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -34,15 +35,16 @@ public class CookieHelper
|
||||||
{
|
{
|
||||||
public enum Scope
|
public enum Scope
|
||||||
{
|
{
|
||||||
HTTP_AND_HTTPS, HTTPS_ONLY
|
HTTP_AND_HTTPS,
|
||||||
|
HTTPS_ONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
static private final Logger logger = LoggerFactory.getLogger(CookieHelper.class);
|
private static final Logger logger = LoggerFactory.getLogger(CookieHelper.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public Cookie buildCookie(final String name, final String value, final int duration)
|
public static Cookie buildCookie(final String name, final String value, final int duration)
|
||||||
{
|
{
|
||||||
Cookie result;
|
Cookie result;
|
||||||
|
|
||||||
|
@ -55,7 +57,7 @@ public class CookieHelper
|
||||||
/**
|
/**
|
||||||
* Warning: value is UTF-8 URLEncoded!
|
* Warning: value is UTF-8 URLEncoded!
|
||||||
*/
|
*/
|
||||||
static public Cookie buildCookie(final String name, final String value, final int duration, final Scope secure)
|
public static Cookie buildCookie(final String name, final String value, final int duration, final Scope secure)
|
||||||
{
|
{
|
||||||
Cookie result;
|
Cookie result;
|
||||||
|
|
||||||
|
@ -91,7 +93,7 @@ public class CookieHelper
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public boolean exists(final HttpServletRequest request, final String key)
|
public static boolean exists(final HttpServletRequest request, final String key)
|
||||||
{
|
{
|
||||||
boolean result;
|
boolean result;
|
||||||
|
|
||||||
|
@ -111,7 +113,7 @@ public class CookieHelper
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public Cookie getCookie(final Cookie[] cookies, final String key)
|
public static Cookie getCookie(final Cookie[] cookies, final String key)
|
||||||
{
|
{
|
||||||
Cookie result = null;
|
Cookie result = null;
|
||||||
|
|
||||||
|
@ -152,7 +154,7 @@ public class CookieHelper
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public Cookie getCookie(final HttpServletRequest request, final String key)
|
public static Cookie getCookie(final HttpServletRequest request, final String key)
|
||||||
{
|
{
|
||||||
Cookie result = null;
|
Cookie result = null;
|
||||||
|
|
||||||
|
@ -195,7 +197,7 @@ public class CookieHelper
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public Object getCookieValue(final HttpServletRequest request, final String key)
|
public static Object getCookieValue(final HttpServletRequest request, final String key)
|
||||||
{
|
{
|
||||||
Object result;
|
Object result;
|
||||||
|
|
||||||
|
@ -208,7 +210,7 @@ public class CookieHelper
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public void reset(final HttpServletResponse response, final String key)
|
public static void reset(final HttpServletResponse response, final String key)
|
||||||
{
|
{
|
||||||
response.addCookie(buildCookie(key, "", 0));
|
response.addCookie(buildCookie(key, "", 0));
|
||||||
}
|
}
|
||||||
|
@ -216,7 +218,7 @@ public class CookieHelper
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public void set(final HttpServletResponse response, final String name, final String value, final int duration)
|
public static void set(final HttpServletResponse response, final String name, final String value, final int duration)
|
||||||
{
|
{
|
||||||
response.addCookie(buildCookie(name, value, duration));
|
response.addCookie(buildCookie(name, value, duration));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* 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 Devinsy-utils.
|
||||||
*
|
*
|
||||||
|
@ -33,7 +33,7 @@ public class FileItemHelper
|
||||||
/**
|
/**
|
||||||
* List FileItem
|
* List FileItem
|
||||||
*/
|
*/
|
||||||
static public FileItem getItem(final List items, final String name)
|
public static FileItem getItem(final List items, final String name)
|
||||||
{
|
{
|
||||||
FileItem result;
|
FileItem result;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class FileItemHelper
|
||||||
/**
|
/**
|
||||||
* List FileItem
|
* List FileItem
|
||||||
*/
|
*/
|
||||||
static public String getItemValue(final List items, final String name)
|
public static String getItemValue(final List items, final String name)
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
@ -24,7 +24,6 @@ import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
@ -39,25 +38,23 @@ import fr.devinsy.util.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename KissDispatcher?
|
* Rename KissDispatcher?
|
||||||
|
*
|
||||||
|
* According that URL is under UTF-8 format. Set Tomcat connector if needs
|
||||||
|
* (<connector ... URIEncoding="UTF-8" ... />).
|
||||||
*/
|
*/
|
||||||
public class SimpleServletDispatcher extends HttpServlet
|
public class KissDispatcher extends HttpServlet
|
||||||
{
|
{
|
||||||
public enum ContentDispositionType
|
public enum ContentDispositionType
|
||||||
{
|
{
|
||||||
ATTACHMENT, INLINE
|
ATTACHMENT,
|
||||||
|
INLINE
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = -3471226305721330069L;
|
private static final long serialVersionUID = -3471226305721330069L;
|
||||||
|
|
||||||
static private Logger logger = LoggerFactory.getLogger(SimpleServletDispatcher.class);
|
private static Logger logger = LoggerFactory.getLogger(KissDispatcher.class);
|
||||||
|
|
||||||
static final private Pattern SHORT_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-.+\\.xhtml$");
|
public static final int CACHE_AGE = 2 * 60 * 60;
|
||||||
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 private Pattern REWRITE_PARAMETER = Pattern.compile("[^%\\w\\d]");
|
|
||||||
static final public int CACHE_AGE = 2 * 60 * 60;
|
|
||||||
|
|
||||||
private String webclassesRootPath;
|
private String webclassesRootPath;
|
||||||
|
|
||||||
|
@ -67,25 +64,7 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
* Note: characters array avalaible here
|
* 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;
|
protected static char NONE = (char) 0;
|
||||||
|
|
||||||
static protected 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' };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -300,7 +279,7 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public HttpServlet instanciateServlet(final String className)
|
public static HttpServlet instanciateServlet(final String className)
|
||||||
{
|
{
|
||||||
HttpServlet result;
|
HttpServlet result;
|
||||||
|
|
||||||
|
@ -343,26 +322,6 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract values from a path.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* "/article-/123/doors/open.xhtml";
|
|
||||||
* => "123", "doors" and "open".
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
static public String[] longRewritedUrlParameters(final String path)
|
|
||||||
{
|
|
||||||
String[] result;
|
|
||||||
|
|
||||||
result = path.substring(path.indexOf("-/") + 2).split("/");
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a path in a class name, using easy conventions.
|
* Convert a path in a class name, using easy conventions.
|
||||||
*
|
*
|
||||||
|
@ -378,7 +337,7 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public String pathInfoToClassName(final String pathInfo)
|
public static String pathInfoToClassName(final String pathInfo)
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
|
@ -461,7 +420,7 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public String pathInfoToClassName(final String pathInfo, final String prefix)
|
public static String pathInfoToClassName(final String pathInfo, final String prefix)
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
|
@ -487,7 +446,7 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public void returnAttachmentFile(final HttpServletResponse response, final File file, final String mimeType) throws IOException
|
public static void returnAttachmentFile(final HttpServletResponse response, final File file, final String mimeType) throws IOException
|
||||||
{
|
{
|
||||||
returnFile(response, file, mimeType, ContentDispositionType.ATTACHMENT);
|
returnFile(response, file, mimeType, ContentDispositionType.ATTACHMENT);
|
||||||
}
|
}
|
||||||
|
@ -495,7 +454,7 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public void returnFile(final HttpServletResponse response, final File file, final String mimeType, final ContentDispositionType contentDisposition) throws IOException
|
public static void returnFile(final HttpServletResponse response, final File file, final String mimeType, final ContentDispositionType contentDisposition) throws IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((file == null) || (!file.exists()))
|
if ((file == null) || (!file.exists()))
|
||||||
|
@ -574,7 +533,7 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public void returnFile(final HttpServletResponse response, final String fileName, final byte[] data, final String mimeType, final ContentDispositionType contentDisposition,
|
public static void returnFile(final HttpServletResponse response, final String fileName, final byte[] data, final String mimeType, final ContentDispositionType contentDisposition,
|
||||||
final int cacheAge) throws IOException
|
final int cacheAge) throws IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -637,231 +596,8 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public void returnInlineFile(final HttpServletResponse response, final File file, final String mimeType) throws IOException
|
public static void returnInlineFile(final HttpServletResponse response, final File file, final String mimeType) throws IOException
|
||||||
{
|
{
|
||||||
returnFile(response, file, mimeType, ContentDispositionType.INLINE);
|
returnFile(response, file, mimeType, ContentDispositionType.INLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static public String[] rewritedUrlParameters(final HttpServletRequest request)
|
|
||||||
{
|
|
||||||
String[] result;
|
|
||||||
|
|
||||||
result = longRewritedUrlParameters(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:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* "/good/give_file?id=123&filename=foo.jpg"
|
|
||||||
* => rewriteShorturl("/good/give_file", "123", "foo.jpg");
|
|
||||||
* => "/good/give_file-/123/foo.jpg"
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* Note: "-/" is used to indicate the start of parameters.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static public String rewriteLongUrl(final String uri, final String... parameters)
|
|
||||||
{
|
|
||||||
String result;
|
|
||||||
|
|
||||||
StringList string = new StringList();
|
|
||||||
|
|
||||||
string.append(uri).append("-");
|
|
||||||
if ((parameters == null) || (parameters.length == 0))
|
|
||||||
{
|
|
||||||
string.append("/");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (String parameter : parameters)
|
|
||||||
{
|
|
||||||
string.append("/").append(parameter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = string.toString();
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param parameter
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* "/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"
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
static public String rewriteShortUrl(final String uri, final String extension, final String... parameters)
|
|
||||||
{
|
|
||||||
String result;
|
|
||||||
|
|
||||||
StringList string = new StringList();
|
|
||||||
|
|
||||||
string.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("-"));
|
|
||||||
string.append("-").append(rewriteParameter(parameter));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((extension != null) && (extension.length() != 0))
|
|
||||||
{
|
|
||||||
string.append(".").append(extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
result = string.toString();
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static public String shortRewritedUrlParameter(final HttpServletRequest request)
|
|
||||||
{
|
|
||||||
String result;
|
|
||||||
|
|
||||||
result = shortRewritedUrlParameter(request.getRequestURI());
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return value of the first parameter.
|
|
||||||
*/
|
|
||||||
static public String shortRewritedUrlParameter(final String path)
|
|
||||||
{
|
|
||||||
String result;
|
|
||||||
|
|
||||||
String[] results = shortRewritedUrlParameters(path);
|
|
||||||
|
|
||||||
if ((results == null) || (results.length == 0))
|
|
||||||
{
|
|
||||||
result = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = results[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static public String[] shortRewritedUrlParameters(final HttpServletRequest request)
|
|
||||||
{
|
|
||||||
String[] result;
|
|
||||||
|
|
||||||
result = shortRewritedUrlParameters(request.getRequestURI());
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract value from a path. Example: "/article-123.xhtml" => "123".
|
|
||||||
*/
|
|
||||||
static public String[] shortRewritedUrlParameters(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);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2010, 2013-2014 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
@ -36,10 +36,11 @@ import fr.devinsy.kiss4web.security.User;
|
||||||
public class PageManager extends HttpServlet
|
public class PageManager extends HttpServlet
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1983715791417570578L;
|
private static final long serialVersionUID = 1983715791417570578L;
|
||||||
private static PageManager instance = null;
|
|
||||||
protected SecurityAgent securityAgent;
|
|
||||||
|
|
||||||
static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(PageManager.class);
|
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(PageManager.class);
|
||||||
|
|
||||||
|
private static PageManager instance = null;
|
||||||
|
private SecurityAgent securityAgent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -238,7 +239,7 @@ public class PageManager extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public String buildClassName2(final String pathInfo)
|
public static String buildClassName2(final String pathInfo)
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
|
@ -353,7 +354,7 @@ public class PageManager extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public String formatClassName(final String name)
|
public static String formatClassName(final String name)
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
|
@ -382,7 +383,7 @@ public class PageManager extends HttpServlet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public User getUserFromSession(final HttpServletRequest request)
|
public static User getUserFromSession(final HttpServletRequest request)
|
||||||
{
|
{
|
||||||
User result;
|
User result;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
@ -28,12 +28,12 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class Redirector
|
public class Redirector
|
||||||
{
|
{
|
||||||
static private final Logger logger = LoggerFactory.getLogger(Redirector.class);
|
private static final Logger logger = LoggerFactory.getLogger(Redirector.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public void redirect(final HttpServletResponse response, final String destination)
|
public static void redirect(final HttpServletResponse response, final String destination)
|
||||||
{
|
{
|
||||||
logger.info("Redirect to <" + destination + ">");
|
logger.info("Redirect to <" + destination + ">");
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ServletDispatcher extends SimpleServletDispatcher
|
public class ServletDispatcher extends KissDispatcher
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -3471226305721330069L;
|
private static final long serialVersionUID = -3471226305721330069L;
|
||||||
static private Logger logger;
|
private static Logger logger;
|
||||||
|
|
||||||
// protected Servlets servlets;
|
// protected Servlets servlets;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2010, 2013-2014 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
@ -32,7 +32,7 @@ import fr.devinsy.util.StringList;
|
||||||
*/
|
*/
|
||||||
public class SimpleSecurityAgent
|
public class SimpleSecurityAgent
|
||||||
{
|
{
|
||||||
static private final Logger logger = LoggerFactory.getLogger(SimpleSecurityAgent.class);
|
private static final Logger logger = LoggerFactory.getLogger(SimpleSecurityAgent.class);
|
||||||
public static final String USERID_LABEL = "securityAgent.userId";
|
public static final String USERID_LABEL = "securityAgent.userId";
|
||||||
public static final String ACCOUNTID_LABEL = "securityAgent.accountId";
|
public static final String ACCOUNTID_LABEL = "securityAgent.accountId";
|
||||||
public static final String AUTH_LABEL = "securityAgent.auth";
|
public static final String AUTH_LABEL = "securityAgent.auth";
|
||||||
|
@ -116,7 +116,7 @@ public class SimpleSecurityAgent
|
||||||
*/
|
*/
|
||||||
public int getAuthenticationDuration()
|
public int getAuthenticationDuration()
|
||||||
{
|
{
|
||||||
return authenticationDuration;
|
return this.authenticationDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,7 +224,7 @@ public class SimpleSecurityAgent
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public String digest(final String... keys)
|
public static String digest(final String... keys)
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web.security;
|
package fr.devinsy.kiss4web.security;
|
||||||
|
@ -25,8 +25,8 @@ import java.util.Vector;
|
||||||
*/
|
*/
|
||||||
public class Group
|
public class Group
|
||||||
{
|
{
|
||||||
protected String name;
|
private String name;
|
||||||
protected Vector<String> members;
|
private Vector<String> members;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2010, 2013-2014 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web.security;
|
package fr.devinsy.kiss4web.security;
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web.security;
|
package fr.devinsy.kiss4web.security;
|
||||||
|
@ -30,7 +30,7 @@ public class GroupsFileReader
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public Groups load(final String fileName) throws Exception
|
public static Groups load(final String fileName) throws Exception
|
||||||
{
|
{
|
||||||
Groups result;
|
Groups result;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/**
|
||||||
|
* 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 <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
package fr.devinsy.kiss4web.security;
|
package fr.devinsy.kiss4web.security;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -7,9 +25,9 @@ import java.util.Iterator;
|
||||||
*/
|
*/
|
||||||
public class SecurityAgent
|
public class SecurityAgent
|
||||||
{
|
{
|
||||||
protected Users users;
|
private Users users;
|
||||||
protected Groups groups;
|
private Groups groups;
|
||||||
protected Groups permissions;
|
private Groups permissions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web.security;
|
package fr.devinsy.kiss4web.security;
|
||||||
|
@ -23,10 +23,10 @@ package fr.devinsy.kiss4web.security;
|
||||||
*/
|
*/
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
protected String login;
|
private String login;
|
||||||
protected String password;
|
private String password;
|
||||||
protected String realName;
|
private String realName;
|
||||||
protected String email;
|
private String email;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
|
* Copyright (C) 2006-2010, 2013-2014 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web.security;
|
package fr.devinsy.kiss4web.security;
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Kiss4web is distributed in the hope that it will be useful,
|
* Kiss4web is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 <http://www.gnu.org/licenses/>
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web.security;
|
package fr.devinsy.kiss4web.security;
|
||||||
|
@ -30,7 +30,7 @@ public class UsersFileReader
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public Users load(final String fileName) throws Exception
|
public static Users load(final String fileName) throws Exception
|
||||||
{
|
{
|
||||||
Users result;
|
Users result;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue