[amazonechocontrol] Fix Servlet exceptions due to non-unique names (#16152)

Fixes #16149

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2023-12-31 01:03:24 +01:00 committed by GitHub
parent d620d261b7
commit eba975c040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<Object, Object> initParams = new Hashtable<>();
initParams.put("servlet-name", servletUrl);
httpService.registerServlet(servletUrl, this, initParams, httpService.createDefaultHttpContext());
} catch (NamespaceException | ServletException e) {
throw new IllegalStateException(e.getMessage());
}