From 4269e3ea2a345d0962f2895a93b7c8df2c665c39 Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Sun, 31 Dec 2023 01:03:24 +0100 Subject: [PATCH] [amazonechocontrol] Fix Servlet exceptions due to non-unique names (#16152) Fixes #16149 Signed-off-by: Wouter Born --- .../binding/amazonechocontrol/internal/AccountServlet.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/AccountServlet.java b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/AccountServlet.java index 0b38a5ec3..6dc9e0510 100644 --- a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/AccountServlet.java +++ b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/AccountServlet.java @@ -20,6 +20,7 @@ import java.net.URLDecoder; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.HashMap; +import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -90,7 +91,10 @@ public class AccountServlet extends HttpServlet { servletUrlWithoutRoot = "amazonechocontrol/" + URLEncoder.encode(id, StandardCharsets.UTF_8); servletUrl = "/" + servletUrlWithoutRoot; - httpService.registerServlet(servletUrl, this, null, httpService.createDefaultHttpContext()); + Hashtable initParams = new Hashtable<>(); + initParams.put("servlet-name", servletUrl); + + httpService.registerServlet(servletUrl, this, initParams, httpService.createDefaultHttpContext()); } catch (NamespaceException | ServletException e) { throw new IllegalStateException(e.getMessage()); }