[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 Jacob Laursen
parent 72e22e241f
commit 4269e3ea2a
1 changed files with 5 additions and 1 deletions

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());
}