-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UNDERTOW-2303] Removed @SInCE tags from JavaDoc. Updated copyright h…
…eaders to 2024. Removed synchronisation for toString(). Fixed Spotbugs issues.
- Loading branch information
Showing
5 changed files
with
16 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2014 Red Hat, Inc., and individual contributors | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -37,7 +37,7 @@ | |
/** | ||
* A Handler that handles the common case of routing via path template and method name. | ||
* | ||
* @author Dirk Roets [email protected]. This class was originally written by Stuart Douglas. After the introduction | ||
* @author Dirk Roets. This class was originally written by Stuart Douglas. After the introduction | ||
* of {@link PathTemplateRouter}, it was rewritten against the original interface and tests. | ||
*/ | ||
public class RoutingHandler implements HttpHandler { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2014 Red Hat, Inc., and individual contributors | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -33,9 +33,8 @@ | |
* by instantiating it with a {@link PathTemplateRouter}. This class implements all of the methods from | ||
* the original PathTemplateHandler to provide backwards compatibility. | ||
* | ||
* @author Dirk Roets [email protected]. This class was originally written by Stuart Douglas. After the introduction | ||
* @author Dirk Roets. This class was originally written by Stuart Douglas. After the introduction | ||
* of {@link PathTemplateRouter}, it was rewritten against the original interface and tests. | ||
* @since 2023-07-20 | ||
*/ | ||
public class PathTemplateHandler implements HttpHandler { | ||
|
||
|
@@ -135,10 +134,8 @@ public PathTemplateHandler remove(final String uriTemplate) { | |
|
||
@Override | ||
public String toString() { | ||
final List<PathTemplateRouter.PatternEqualsAdapter<PathTemplateRouter.Template<Supplier<HttpHandler>>>> templates; | ||
synchronized (lock) { | ||
templates = new ArrayList<>(builder.getBuilder().getTemplates().keySet()); | ||
} | ||
final List<PathTemplateRouter.PatternEqualsAdapter<PathTemplateRouter.Template<Supplier<HttpHandler>>>> templates | ||
= new ArrayList<>(builder.getBuilder().getTemplates().keySet()); | ||
|
||
final StringBuilder sb = new StringBuilder(); | ||
sb.append("path-template( "); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2014 Red Hat, Inc., and individual contributors | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -28,8 +28,7 @@ | |
/** | ||
* A handler that matches URI templates. | ||
* | ||
* @author Dirk Roets [email protected] | ||
* @since 2023-07-20 | ||
* @author Dirk Roets | ||
* @see PathTemplateRouter | ||
*/ | ||
public class PathTemplateRouterHandler implements HttpHandler { | ||
|
@@ -59,7 +58,6 @@ public void handleRequest(final HttpServerExchange exchange) throws Exception { | |
return; | ||
} | ||
|
||
final String pathTemplate = routeResult.getPathTemplate().get(); | ||
exchange.putAttachment(PATH_TEMPLATE_MATCH, new PathTemplateHandler.PathTemplateMatch(routeResult)); | ||
exchange.putAttachment(io.undertow.util.PathTemplateMatch.ATTACHMENT_KEY, routeResult); | ||
if (rewriteQueryParameters && !routeResult.getParameters().isEmpty()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2014 Red Hat, Inc., and individual contributors | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -40,8 +40,7 @@ | |
* | ||
* Instances of this class are thread-safe. | ||
* | ||
* @author Dirk Roets [email protected] | ||
* @since 2023-03-07 | ||
* @author Dirk Roets | ||
*/ | ||
/* | ||
* Warning: | ||
|
@@ -1335,7 +1334,6 @@ private static class RouterFactory<T> { | |
private List<Integer> currentParamIndexes; | ||
private List<String> currentParamNames; | ||
private MatcherLeaveArterfacts<Supplier<? extends T>> currentLeave; | ||
private TemplateSegment currentSegment; | ||
// Resulting matchers. | ||
private Matcher[] matchers; | ||
private Matcher[] wildCardMatchers; | ||
|
@@ -1436,7 +1434,6 @@ private MatcherLeaveArterfacts<Supplier<? extends T>> getCurrentRootLeave() { | |
|
||
private void processSegment(final TemplateSegment segment) { | ||
segmentStack.add(segment); | ||
currentSegment = segment; | ||
|
||
final PatternEqualsAdapter<TemplateSegment> adapter = new PatternEqualsAdapter<>(segment); | ||
MatcherLeaveArterfacts<Supplier<? extends T>> nextLeave = currentLeave.children.get(adapter); | ||
|
@@ -2079,12 +2076,11 @@ public static <T> SimpleBuilder<T> newBuilder(final T defaultTarget) { | |
/** | ||
* Creates a new instance of the simple builder. | ||
* | ||
* @param <T> Target type for built routes. | ||
* | ||
* @return Reference to the builder. | ||
*/ | ||
public static <T> SimpleBuilder<T> newBuilder() { | ||
return newBuilder(null); | ||
public static SimpleBuilder<Void> newBuilder() { | ||
final Builder<Supplier<Void>, Void> builder = Builder.newBuilder(); | ||
return new SimpleBuilder<>(builder); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2014 Red Hat, Inc., and individual contributors | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -36,8 +36,7 @@ | |
* Some tests that were specifically used to test during the development of {@link PathTemplateRouter} as well as | ||
* an adaptation of the tests in {@link PathTemplateTestCase} to confirm compatibility with {@link PathTemplateMatcher}. | ||
* | ||
* @author Dirk Roets [email protected] | ||
* @since 2023-03-08 | ||
* @author Dirk Roets | ||
*/ | ||
@Category(UnitTest.class) | ||
public class PathTemplateRouterTest { | ||
|
@@ -433,7 +432,7 @@ private static long routeNew( | |
"default" | ||
); | ||
for (final String template : templates) | ||
routerBuilder.addTemplate(template, ()->template); | ||
routerBuilder.addTemplate(template, () -> template); | ||
final PathTemplateRouter.Router<String> router = routerBuilder.build(); | ||
|
||
PathTemplateRouter.RouteResult<String> pathRouteResult; | ||
|