Skip to content

Commit

Permalink
[amazonechocontrol] Fix Servlet exceptions due to non-unique names (o…
Browse files Browse the repository at this point in the history
…penhab#16152)

Fixes openhab#16149

Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn authored Dec 31, 2023
1 parent d620d26 commit eba975c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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;
Expand Down Expand Up @@ -90,7 +91,10 @@ public AccountServlet(HttpService httpService, String id, AccountHandler account
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());
}
Expand Down

0 comments on commit eba975c

Please sign in to comment.