From 66234efc7fe9122335c4d5d91c44997ca04397d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maltoni?= Date: Thu, 21 Nov 2024 15:20:21 +0100 Subject: [PATCH] refactor: cleanup RoutesResource --- .../org/carapaceproxy/api/RoutesResource.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/carapace-server/src/main/java/org/carapaceproxy/api/RoutesResource.java b/carapace-server/src/main/java/org/carapaceproxy/api/RoutesResource.java index 97080720c..2de48a705 100644 --- a/carapace-server/src/main/java/org/carapaceproxy/api/RoutesResource.java +++ b/carapace-server/src/main/java/org/carapaceproxy/api/RoutesResource.java @@ -19,6 +19,7 @@ */ package org.carapaceproxy.api; +import static org.carapaceproxy.server.mapper.StandardEndpointMapper.ACME_CHALLENGE_ROUTE_ACTION_ID; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletContext; @@ -26,7 +27,6 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import org.carapaceproxy.core.HttpProxyServer; -import static org.carapaceproxy.server.mapper.StandardEndpointMapper.ACME_CHALLENGE_ROUTE_ACTION_ID; /** * Access to configured routes @@ -77,24 +77,25 @@ public String getMatcher() { return matcher; } - public String getMaintenanceAction() { return maintenanceAction; } + public String getMaintenanceAction() { + return maintenanceAction; + } } @GET public List getAll() { - final List routes = new ArrayList(); + final List routes = new ArrayList<>(); HttpProxyServer server = (HttpProxyServer) context.getAttribute("server"); server.getMapper().getRoutes().stream() .filter(r -> !r.getId().equals(ACME_CHALLENGE_ROUTE_ACTION_ID)) - .forEach(route -> { - routes.add(new RouteBean( - route.getId(), - route.getAction(), - route.getErrorAction(), - route.isEnabled(), - route.getMatcher().getDescription(), - route.getMaintenanceModeAction())); - }); + .forEach(route -> routes.add(new RouteBean( + route.getId(), + route.getAction(), + route.getErrorAction(), + route.isEnabled(), + route.getMatcher().getDescription(), + route.getMaintenanceModeAction() + ))); return routes; }