Remove redundant comments and unused imports to improve code clarity and maintainability
Auto Publish on Version Change / check-and-publish (push) Successful in 14s
Auto Publish on Version Change / check-and-publish (push) Successful in 14s
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package dev.coph.nextusweb.server.cores;
|
package dev.coph.nextusweb.server.cores;
|
||||||
|
|
||||||
import dev.coph.nextusweb.server.cores.CorsConfig;
|
|
||||||
import dev.coph.nextusweb.server.router.Response;
|
import dev.coph.nextusweb.server.router.Response;
|
||||||
import io.netty.handler.codec.http.*;
|
import io.netty.handler.codec.http.*;
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ public final class RateLimitGate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doCleanup() {
|
private void doCleanup() {
|
||||||
// 10 Minuten in Nanosekunden
|
|
||||||
long threshold = 10L * 60 * 1_000_000_000L;
|
long threshold = 10L * 60 * 1_000_000_000L;
|
||||||
// Cleanup-Methoden müssten an alle Limiter durchgereicht werden – simplifiziert:
|
|
||||||
// In der Praxis: registriere alle Limiter und rufe ihre cleanup-Methode auf.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() { cleanup.shutdown(); }
|
public void shutdown() { cleanup.shutdown(); }
|
||||||
|
|||||||
@@ -64,13 +64,7 @@ public final class Router {
|
|||||||
public Router delete(String path, Handler h) {
|
public Router delete(String path, Handler h) {
|
||||||
return register(HttpMethod.DELETE, path, h);
|
return register(HttpMethod.DELETE, path, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolve den Pfad zu einem Handler. Liefert:
|
|
||||||
* - Match wenn Pfad + Methode passen
|
|
||||||
* - MethodNotAllowed wenn der Pfad existiert, aber nicht für diese Methode
|
|
||||||
* - NotFound wenn der Pfad gar nicht registriert ist
|
|
||||||
*/
|
|
||||||
public Resolution resolve(HttpMethod method, String path) {
|
public Resolution resolve(HttpMethod method, String path) {
|
||||||
Map<String, String> params = new HashMap<>(4);
|
Map<String, String> params = new HashMap<>(4);
|
||||||
Node node = root;
|
Node node = root;
|
||||||
@@ -93,7 +87,6 @@ public final class Router {
|
|||||||
return new Resolution.Match(h, params);
|
return new Resolution.Match(h, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pfad existiert, aber nicht für diese Methode
|
|
||||||
if (!node.handlers.isEmpty()) {
|
if (!node.handlers.isEmpty()) {
|
||||||
return new Resolution.MethodNotAllowed(
|
return new Resolution.MethodNotAllowed(
|
||||||
Collections.unmodifiableSet(node.handlers.keySet()));
|
Collections.unmodifiableSet(node.handlers.keySet()));
|
||||||
@@ -125,8 +118,8 @@ public final class Router {
|
|||||||
private static final class Node {
|
private static final class Node {
|
||||||
final Map<String, Node> children = new ConcurrentHashMap<>();
|
final Map<String, Node> children = new ConcurrentHashMap<>();
|
||||||
final Map<HttpMethod, Handler> handlers = new ConcurrentHashMap<>();
|
final Map<HttpMethod, Handler> handlers = new ConcurrentHashMap<>();
|
||||||
Node paramChild; // für {id}
|
Node paramChild;
|
||||||
String paramName;
|
String paramName;
|
||||||
Node wildcardChild; // für *
|
Node wildcardChild;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user