-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
None
-
False
While adding support for the REST protocol there was a requirement to look at the REST resources to register the context. This is one possibly using the wrong context because of how the context is parsed. Two it's causing a different context path to be registered. When more than one context is registered and a URI or URL are injected, then no context is appended.
The URLResourceProvider has something like:
... // TODO: evaluate, if all servlets are in the same context, and only one context exists, we can find the context else if (allInSameContext(context.getServlets())) { return toURL(context.getServlets().get(0)); } else { return toURL(context); } ... private boolean allInSameContext(List<Servlet> servlets) { Set<String> context = new HashSet<String>(); for (Servlet servlet : servlets) { context.add(servlet.getContextRoot()); } return context.size() == 1; }
This could be an issue for previously working injection where the context was expected.
The simplest option is to only define the web context. As an example assuming the REST path is http://localhost:8080/test-deployment/rest/greet. We should register the context path as "test-deployment" not "test-deployment/rest".
We could, if not servlet is registered, register the context as "test-deployment/rest". However, that could introduce confusing failures if a servlet is ever added. It would be consistent behavior if we leave it as "test-deployment" given the above example.
- is related to
-
WFARQ-117 Do not fail if missing the Undertow or REST subsystem
- Resolved