From dd682a6b0a56ef26fbf8b22afc68f7a829758747 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sun, 18 Aug 2024 22:36:23 +0200 Subject: [PATCH] Made a Javadoc review. --- .../kiss4web/dispatcher/KissDispatcher.java | 5 ++- .../dispatcher/KissDispatcherFactory.java | 9 ++-- .../dispatcher/KissDispatcherUtils.java | 12 +++-- .../annotation/AnnotationUtils.java | 2 - .../dispatcher/annotation/KissServlet.java | 8 ++++ .../annotation/KissServletProcessor.java | 3 ++ .../kiss4web/dispatcher/hooks/DirectHook.java | 4 +- .../dispatcher/hooks/DirectServlet.java | 7 ++- .../dispatcher/hooks/ErrorServlet.java | 8 ++++ .../dispatcher/hooks/HookRegister.java | 4 +- .../dispatcher/hooks/WebContentHook.java | 3 -- src/fr/devinsy/kiss4web/security/Groups.java | 44 ++++++++++++------- 12 files changed, 72 insertions(+), 37 deletions(-) diff --git a/src/fr/devinsy/kiss4web/dispatcher/KissDispatcher.java b/src/fr/devinsy/kiss4web/dispatcher/KissDispatcher.java index f9df51c..24db377 100755 --- a/src/fr/devinsy/kiss4web/dispatcher/KissDispatcher.java +++ b/src/fr/devinsy/kiss4web/dispatcher/KissDispatcher.java @@ -36,8 +36,9 @@ import jakarta.servlet.http.HttpServletRequest; * The Class KissDispatcher. * * According that URL is under UTF-8 format. Set Tomcat connector if needs - * (). - * + *
+ * .
+ * 
*/ public class KissDispatcher { diff --git a/src/fr/devinsy/kiss4web/dispatcher/KissDispatcherFactory.java b/src/fr/devinsy/kiss4web/dispatcher/KissDispatcherFactory.java index 57829f4..1cac1bc 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/KissDispatcherFactory.java +++ b/src/fr/devinsy/kiss4web/dispatcher/KissDispatcherFactory.java @@ -31,13 +31,13 @@ import jakarta.servlet.http.HttpServlet; */ public class KissDispatcherFactory { + static Logger logger = LoggerFactory.getLogger(KissDispatcherFactory.class); + private static class SingletonHolder { private static final KissDispatcherFactory instance = new KissDispatcherFactory(); } - static Logger logger = LoggerFactory.getLogger(KissDispatcherFactory.class); - /* * Need to avoid servlet duplication when more than pathinfo is matching a servlet. * ClassPath -> Servlet. @@ -66,10 +66,11 @@ public class KissDispatcherFactory * * @param config * the config - * @param request - * the request + * @param servletClass + * the servlet class * @return the http servlet * @throws ServletException + * the servlet exception */ public HttpServlet provideServlet(final ServletConfig config, final Class servletClass) throws ServletException { diff --git a/src/fr/devinsy/kiss4web/dispatcher/KissDispatcherUtils.java b/src/fr/devinsy/kiss4web/dispatcher/KissDispatcherUtils.java index bddff56..db68859 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/KissDispatcherUtils.java +++ b/src/fr/devinsy/kiss4web/dispatcher/KissDispatcherUtils.java @@ -44,14 +44,14 @@ import jakarta.servlet.http.HttpServletResponse; */ public class KissDispatcherUtils { + static Logger logger = LoggerFactory.getLogger(KissDispatcherUtils.class); + public enum ContentDispositionType { ATTACHMENT, INLINE } - static Logger logger = LoggerFactory.getLogger(KissDispatcherUtils.class); - /** * Builds the class name. * @@ -259,8 +259,8 @@ public class KissDispatcherUtils /** * Checks if is available path. * - * @param urlPath - * the url path + * @param path + * the path * @return true, if is available path */ public static boolean isAvailablePath(final String path) @@ -586,6 +586,10 @@ public class KissDispatcherUtils } catch (IOException exception) { + System.out.println("/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\/!\\"); + exception.printStackTrace(); + // TODO As sendError cannot be send because partial content has + // been send, we have to replace this with a better way. response.sendError(HttpServletResponse.SC_PARTIAL_CONTENT); } finally diff --git a/src/fr/devinsy/kiss4web/dispatcher/annotation/AnnotationUtils.java b/src/fr/devinsy/kiss4web/dispatcher/annotation/AnnotationUtils.java index e95bcaf..5bb8cac 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/annotation/AnnotationUtils.java +++ b/src/fr/devinsy/kiss4web/dispatcher/annotation/AnnotationUtils.java @@ -28,7 +28,6 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import fr.devinsy.kiss4web.Kiss4webException; import jakarta.servlet.http.HttpServlet; /** @@ -79,7 +78,6 @@ public class AnnotationUtils * Gets the annotation hooks. * * @return the annotation hooks - * @throws Kiss4webException */ public static AnnotationHooks getAnnotationHooks() { diff --git a/src/fr/devinsy/kiss4web/dispatcher/annotation/KissServlet.java b/src/fr/devinsy/kiss4web/dispatcher/annotation/KissServlet.java index ac8e58f..c858ded 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/annotation/KissServlet.java +++ b/src/fr/devinsy/kiss4web/dispatcher/annotation/KissServlet.java @@ -23,9 +23,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * The Interface KissServlet. + */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface KissServlet { + /** + * Value of the pathInfo regex to map on the annoted class.. + * + * @return the string + */ String value(); } diff --git a/src/fr/devinsy/kiss4web/dispatcher/annotation/KissServletProcessor.java b/src/fr/devinsy/kiss4web/dispatcher/annotation/KissServletProcessor.java index 4c9d62d..cc70c90 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/annotation/KissServletProcessor.java +++ b/src/fr/devinsy/kiss4web/dispatcher/annotation/KissServletProcessor.java @@ -27,6 +27,9 @@ import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic; +/** + * The Class KissServletProcessor. + */ @javax.annotation.processing.SupportedAnnotationTypes("fr.devinsy.kiss4web.dispatcher.annotation.KissServlet") @javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_17) public class KissServletProcessor extends AbstractProcessor diff --git a/src/fr/devinsy/kiss4web/dispatcher/hooks/DirectHook.java b/src/fr/devinsy/kiss4web/dispatcher/hooks/DirectHook.java index 275a710..b66c641 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/hooks/DirectHook.java +++ b/src/fr/devinsy/kiss4web/dispatcher/hooks/DirectHook.java @@ -37,10 +37,8 @@ public class DirectHook extends HookCore /** * Instantiates a new direct hook. * - * @param regex - * the regex * @param targetClassName - * the target class path + * the target class name */ public DirectHook(final String targetClassName) { diff --git a/src/fr/devinsy/kiss4web/dispatcher/hooks/DirectServlet.java b/src/fr/devinsy/kiss4web/dispatcher/hooks/DirectServlet.java index f0b52c5..8b11a08 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/hooks/DirectServlet.java +++ b/src/fr/devinsy/kiss4web/dispatcher/hooks/DirectServlet.java @@ -32,7 +32,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; /** - * The Class StaticPageServlet. + * The Class DirectServlet. */ public class DirectServlet extends HttpServlet { @@ -42,7 +42,10 @@ public class DirectServlet extends HttpServlet private String path; /** - * Instantiates a new static page servlet. + * Instantiates a new direct servlet. + * + * @param path + * the path */ public DirectServlet(final String path) { diff --git a/src/fr/devinsy/kiss4web/dispatcher/hooks/ErrorServlet.java b/src/fr/devinsy/kiss4web/dispatcher/hooks/ErrorServlet.java index 24df0e5..b663396 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/hooks/ErrorServlet.java +++ b/src/fr/devinsy/kiss4web/dispatcher/hooks/ErrorServlet.java @@ -46,6 +46,9 @@ public class ErrorServlet extends HttpServlet /** * Instantiates a new error servlet. + * + * @param message + * the message */ public ErrorServlet(final String message) { @@ -54,6 +57,11 @@ public class ErrorServlet extends HttpServlet /** * Instantiates a new error servlet. + * + * @param message + * the message + * @param exception + * the exception */ public ErrorServlet(final String message, final Exception exception) { diff --git a/src/fr/devinsy/kiss4web/dispatcher/hooks/HookRegister.java b/src/fr/devinsy/kiss4web/dispatcher/hooks/HookRegister.java index 43930ab..fc1800b 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/hooks/HookRegister.java +++ b/src/fr/devinsy/kiss4web/dispatcher/hooks/HookRegister.java @@ -123,8 +123,8 @@ public class HookRegister /** * Register. * - * @param hook - * the hook + * @param hooks + * the hooks * @return the hook register */ public HookRegister register(final Collection hooks) diff --git a/src/fr/devinsy/kiss4web/dispatcher/hooks/WebContentHook.java b/src/fr/devinsy/kiss4web/dispatcher/hooks/WebContentHook.java index 7818b3d..a1aa7bd 100644 --- a/src/fr/devinsy/kiss4web/dispatcher/hooks/WebContentHook.java +++ b/src/fr/devinsy/kiss4web/dispatcher/hooks/WebContentHook.java @@ -23,7 +23,6 @@ import java.io.File; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import fr.devinsy.kiss4web.Kiss4webException; import jakarta.servlet.ServletConfig; import jakarta.servlet.ServletContext; import jakarta.servlet.http.HttpServletRequest; @@ -45,8 +44,6 @@ public class WebContentHook extends HookCore /** * {@inheritDoc} - * - * @throws Kiss4webException */ @Override public String getServletClassName(final ServletConfig servletConfig, final HttpServletRequest request) diff --git a/src/fr/devinsy/kiss4web/security/Groups.java b/src/fr/devinsy/kiss4web/security/Groups.java index b4e969a..5650e4e 100644 --- a/src/fr/devinsy/kiss4web/security/Groups.java +++ b/src/fr/devinsy/kiss4web/security/Groups.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON + * Copyright (C) 2006-2010, 2013-2014, 2024 Christian Pierre MOMON * * This file is part of Kiss4web. * @@ -22,22 +22,26 @@ import java.util.Iterator; import java.util.Vector; /** - * + * The Class Groups. */ public class Groups extends Vector { private static final long serialVersionUID = 6238581648850758903L; /** - * - */ + * Instantiates a new groups. + */ public Groups() { super(); } - /* + /** + * Contains. * + * @param name + * the name + * @return true, if successful */ public boolean contains(final String name) { @@ -57,8 +61,12 @@ public class Groups extends Vector } /** - * - */ + * Gets the. + * + * @param name + * the name + * @return the group + */ public Group get(final String name) { Group result; @@ -96,8 +104,12 @@ public class Groups extends Vector } /** - * - */ + * Gets the login groups. + * + * @param login + * the login + * @return the login groups + */ public Vector getLoginGroups(final String login) { Vector result; @@ -120,8 +132,12 @@ public class Groups extends Vector } /** - * - */ + * Gets the login groups string. + * + * @param login + * the login + * @return the login groups string + */ public String getLoginGroupsString(final String login) { String result; @@ -150,8 +166,8 @@ public class Groups extends Vector } /** - * - */ + * {@inheritDoc} + */ @Override public String toString() { @@ -173,5 +189,3 @@ public class Groups extends Vector return (result); } } - -// ////////////////////////////////////////////////////////////////////////