From 7b03494e8b0829da078cc4fa98af5f5b3b1af34b Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 5 Dec 2025 21:47:17 +0100 Subject: [PATCH] Minor refactors --- build.gradle.kts | 8 ++++---- .../httpServer/src/Main.java | 8 ++++---- .../httpServer/src/annotations/AllowedVerb.java | 2 +- .../src/annotations/OnlyAuthorizedClients.java | 2 +- .../src/authorization/AuthorizedClients.java | 2 +- .../httpServer/src/authorization/Client.java | 2 +- .../src/authorization/PasswordHasher.java | 2 +- .../exceptions/ClientAuthorisationException.java | 2 +- .../src/exceptions/NoSuchVerbException.java | 2 +- .../httpServer/src/handlers/IRequestHandler.java | 2 +- .../httpServer/src/handlers/RequestHandler.java | 10 +++++----- .../src/interceptors/RequestInterceptor.java | 14 ++++++-------- 12 files changed, 27 insertions(+), 29 deletions(-) rename src/main/java/{httpsServer => httpServer}/httpServer/src/Main.java (81%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/annotations/AllowedVerb.java (77%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/annotations/OnlyAuthorizedClients.java (84%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/authorization/AuthorizedClients.java (96%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/authorization/Client.java (89%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/authorization/PasswordHasher.java (94%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/exceptions/ClientAuthorisationException.java (76%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/exceptions/NoSuchVerbException.java (74%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/handlers/IRequestHandler.java (82%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/handlers/RequestHandler.java (90%) rename src/main/java/{httpsServer => httpServer}/httpServer/src/interceptors/RequestInterceptor.java (84%) diff --git a/build.gradle.kts b/build.gradle.kts index c91436a..05dac03 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,12 +51,12 @@ tasks.register("jarExternalApp") { dependsOn("classes") } -tasks.register("jarHttpsServer") { +tasks.register("jarHttpServer") { manifest { attributes["Main-Class"] = "Main" } - archiveBaseName.set("httpsServer") - from(sourceSets["httpsServer"].output) + archiveBaseName.set("httpServer") + from(sourceSets["httpServer"].output) dependsOn("classes") } @@ -64,7 +64,7 @@ tasks.named("build") { dependsOn("jarAcq") dependsOn("jarAcs") dependsOn("jarExternalApp") - dependsOn("jarHttpsServer") + dependsOn("jarHttpServer") } group = "be.naaturel" diff --git a/src/main/java/httpsServer/httpServer/src/Main.java b/src/main/java/httpServer/httpServer/src/Main.java similarity index 81% rename from src/main/java/httpsServer/httpServer/src/Main.java rename to src/main/java/httpServer/httpServer/src/Main.java index 6a50429..b19b755 100644 --- a/src/main/java/httpsServer/httpServer/src/Main.java +++ b/src/main/java/httpServer/httpServer/src/Main.java @@ -1,10 +1,10 @@ -package httpsServer.httpServer.src; +package httpServer.httpServer.src; import com.sun.net.httpserver.HttpServer; import common.common.src.logger.Logger; -import httpsServer.httpServer.src.handlers.IRequestHandler; -import httpsServer.httpServer.src.handlers.RequestHandler; -import httpsServer.httpServer.src.interceptors.RequestInterceptor; +import httpServer.httpServer.src.handlers.IRequestHandler; +import httpServer.httpServer.src.handlers.RequestHandler; +import httpServer.httpServer.src.interceptors.RequestInterceptor; import java.io.*; import java.lang.reflect.Proxy; diff --git a/src/main/java/httpsServer/httpServer/src/annotations/AllowedVerb.java b/src/main/java/httpServer/httpServer/src/annotations/AllowedVerb.java similarity index 77% rename from src/main/java/httpsServer/httpServer/src/annotations/AllowedVerb.java rename to src/main/java/httpServer/httpServer/src/annotations/AllowedVerb.java index 3ce09a0..f37adde 100644 --- a/src/main/java/httpsServer/httpServer/src/annotations/AllowedVerb.java +++ b/src/main/java/httpServer/httpServer/src/annotations/AllowedVerb.java @@ -1,4 +1,4 @@ -package httpsServer.httpServer.src.annotations; +package httpServer.httpServer.src.annotations; import java.lang.annotation.*; diff --git a/src/main/java/httpsServer/httpServer/src/annotations/OnlyAuthorizedClients.java b/src/main/java/httpServer/httpServer/src/annotations/OnlyAuthorizedClients.java similarity index 84% rename from src/main/java/httpsServer/httpServer/src/annotations/OnlyAuthorizedClients.java rename to src/main/java/httpServer/httpServer/src/annotations/OnlyAuthorizedClients.java index 9417e4a..9d88441 100644 --- a/src/main/java/httpsServer/httpServer/src/annotations/OnlyAuthorizedClients.java +++ b/src/main/java/httpServer/httpServer/src/annotations/OnlyAuthorizedClients.java @@ -1,4 +1,4 @@ -package httpsServer.httpServer.src.annotations; +package httpServer.httpServer.src.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/httpsServer/httpServer/src/authorization/AuthorizedClients.java b/src/main/java/httpServer/httpServer/src/authorization/AuthorizedClients.java similarity index 96% rename from src/main/java/httpsServer/httpServer/src/authorization/AuthorizedClients.java rename to src/main/java/httpServer/httpServer/src/authorization/AuthorizedClients.java index cb70d74..5b9f1d4 100644 --- a/src/main/java/httpsServer/httpServer/src/authorization/AuthorizedClients.java +++ b/src/main/java/httpServer/httpServer/src/authorization/AuthorizedClients.java @@ -1,4 +1,4 @@ -package httpsServer.httpServer.src.authorization; +package httpServer.httpServer.src.authorization; import org.springframework.security.crypto.bcrypt.BCrypt; diff --git a/src/main/java/httpsServer/httpServer/src/authorization/Client.java b/src/main/java/httpServer/httpServer/src/authorization/Client.java similarity index 89% rename from src/main/java/httpsServer/httpServer/src/authorization/Client.java rename to src/main/java/httpServer/httpServer/src/authorization/Client.java index f0fd906..83d2d25 100644 --- a/src/main/java/httpsServer/httpServer/src/authorization/Client.java +++ b/src/main/java/httpServer/httpServer/src/authorization/Client.java @@ -1,4 +1,4 @@ -package httpsServer.httpServer.src.authorization; +package httpServer.httpServer.src.authorization; import java.util.Objects; diff --git a/src/main/java/httpsServer/httpServer/src/authorization/PasswordHasher.java b/src/main/java/httpServer/httpServer/src/authorization/PasswordHasher.java similarity index 94% rename from src/main/java/httpsServer/httpServer/src/authorization/PasswordHasher.java rename to src/main/java/httpServer/httpServer/src/authorization/PasswordHasher.java index 53472f6..3254c3b 100644 --- a/src/main/java/httpsServer/httpServer/src/authorization/PasswordHasher.java +++ b/src/main/java/httpServer/httpServer/src/authorization/PasswordHasher.java @@ -1,4 +1,4 @@ -package httpsServer.httpServer.src.authorization; +package httpServer.httpServer.src.authorization; import org.springframework.security.crypto.bcrypt.BCrypt; diff --git a/src/main/java/httpsServer/httpServer/src/exceptions/ClientAuthorisationException.java b/src/main/java/httpServer/httpServer/src/exceptions/ClientAuthorisationException.java similarity index 76% rename from src/main/java/httpsServer/httpServer/src/exceptions/ClientAuthorisationException.java rename to src/main/java/httpServer/httpServer/src/exceptions/ClientAuthorisationException.java index aeb1b94..1330b1f 100644 --- a/src/main/java/httpsServer/httpServer/src/exceptions/ClientAuthorisationException.java +++ b/src/main/java/httpServer/httpServer/src/exceptions/ClientAuthorisationException.java @@ -1,4 +1,4 @@ -package httpsServer.httpServer.src.exceptions; +package httpServer.httpServer.src.exceptions; public class ClientAuthorisationException extends Exception { diff --git a/src/main/java/httpsServer/httpServer/src/exceptions/NoSuchVerbException.java b/src/main/java/httpServer/httpServer/src/exceptions/NoSuchVerbException.java similarity index 74% rename from src/main/java/httpsServer/httpServer/src/exceptions/NoSuchVerbException.java rename to src/main/java/httpServer/httpServer/src/exceptions/NoSuchVerbException.java index 94d82b7..799e1dd 100644 --- a/src/main/java/httpsServer/httpServer/src/exceptions/NoSuchVerbException.java +++ b/src/main/java/httpServer/httpServer/src/exceptions/NoSuchVerbException.java @@ -1,4 +1,4 @@ -package httpsServer.httpServer.src.exceptions; +package httpServer.httpServer.src.exceptions; public class NoSuchVerbException extends Exception { diff --git a/src/main/java/httpsServer/httpServer/src/handlers/IRequestHandler.java b/src/main/java/httpServer/httpServer/src/handlers/IRequestHandler.java similarity index 82% rename from src/main/java/httpsServer/httpServer/src/handlers/IRequestHandler.java rename to src/main/java/httpServer/httpServer/src/handlers/IRequestHandler.java index a14b24b..a5884d0 100644 --- a/src/main/java/httpsServer/httpServer/src/handlers/IRequestHandler.java +++ b/src/main/java/httpServer/httpServer/src/handlers/IRequestHandler.java @@ -1,4 +1,4 @@ -package httpsServer.httpServer.src.handlers; +package httpServer.httpServer.src.handlers; import com.sun.net.httpserver.HttpExchange; diff --git a/src/main/java/httpsServer/httpServer/src/handlers/RequestHandler.java b/src/main/java/httpServer/httpServer/src/handlers/RequestHandler.java similarity index 90% rename from src/main/java/httpsServer/httpServer/src/handlers/RequestHandler.java rename to src/main/java/httpServer/httpServer/src/handlers/RequestHandler.java index a3de7cc..bc002e0 100644 --- a/src/main/java/httpsServer/httpServer/src/handlers/RequestHandler.java +++ b/src/main/java/httpServer/httpServer/src/handlers/RequestHandler.java @@ -1,13 +1,13 @@ -package httpsServer.httpServer.src.handlers; +package httpServer.httpServer.src.handlers; import com.fasterxml.jackson.databind.ObjectMapper; import com.sun.net.httpserver.HttpExchange; import common.common.src.html.HtmlManager; import common.common.src.logger.Logger; -import httpsServer.httpServer.src.annotations.AllowedVerb; -import httpsServer.httpServer.src.annotations.OnlyAuthorizedClients; -import httpsServer.httpServer.src.authorization.AuthorizedClients; -import httpsServer.httpServer.src.authorization.Client; +import httpServer.httpServer.src.annotations.AllowedVerb; +import httpServer.httpServer.src.annotations.OnlyAuthorizedClients; +import httpServer.httpServer.src.authorization.AuthorizedClients; +import httpServer.httpServer.src.authorization.Client; import java.io.*; import java.nio.charset.StandardCharsets; diff --git a/src/main/java/httpsServer/httpServer/src/interceptors/RequestInterceptor.java b/src/main/java/httpServer/httpServer/src/interceptors/RequestInterceptor.java similarity index 84% rename from src/main/java/httpsServer/httpServer/src/interceptors/RequestInterceptor.java rename to src/main/java/httpServer/httpServer/src/interceptors/RequestInterceptor.java index 39f6e23..104411b 100644 --- a/src/main/java/httpsServer/httpServer/src/interceptors/RequestInterceptor.java +++ b/src/main/java/httpServer/httpServer/src/interceptors/RequestInterceptor.java @@ -1,16 +1,14 @@ -package httpsServer.httpServer.src.interceptors; +package httpServer.httpServer.src.interceptors; -import com.fasterxml.jackson.databind.ObjectMapper; import com.sun.net.httpserver.HttpExchange; -import httpsServer.httpServer.src.annotations.AllowedVerb; -import httpsServer.httpServer.src.annotations.OnlyAuthorizedClients; -import httpsServer.httpServer.src.authorization.AuthorizedClients; -import httpsServer.httpServer.src.exceptions.NoSuchVerbException; -import httpsServer.httpServer.src.exceptions.ClientAuthorisationException; +import httpServer.httpServer.src.annotations.AllowedVerb; +import httpServer.httpServer.src.annotations.OnlyAuthorizedClients; +import httpServer.httpServer.src.authorization.AuthorizedClients; +import httpServer.httpServer.src.exceptions.NoSuchVerbException; +import httpServer.httpServer.src.exceptions.ClientAuthorisationException; import java.io.IOException; import java.lang.reflect.*; -import java.util.Base64; public class RequestInterceptor implements InvocationHandler {