Markus Jung created TOMEE-4713:
----------------------------------

             Summary: Serve JAX-RS applications through a servlet mapping 
instead of CXFJAXRSFilter
                 Key: TOMEE-4713
                 URL: https://issues.apache.org/jira/browse/TOMEE-4713
             Project: TomEE
          Issue Type: Improvement
            Reporter: Markus Jung
             Fix For: 11.0.0


{{CXFJAXRSFilter}} decides per request whether a URL belongs to JAX-RS: it 
pre-matches class level {{@Path}} templates, serves static files first, gives 
mapped servlets priority by servlet name and detects welcome-file rewrites. 
That duplicates what Tomcat's servlet mapper already does and has produced a 
series of routing bugs (TOMEE-2148, TOMEE-2467, TOMEE-4406, TOMEE-4424, 
TOMEE-4481, TOMEE-4659).

Each JAX-RS application is served by its own servlet instead, so the Servlet 
mapping rules decide routing:
* {{@ApplicationPath}} or a servlet mapping in web.xml: {{<path>/*}} (Jakarta 
REST 2.3.2), including {{@ApplicationPath("/")}}.
* No declared mapping (TomEE extension, served from the context root): {{/}}, 
the default servlet slot. JSP, Faces and user servlets keep priority, static 
files are served by the container's default servlet.
* {{openejb.jaxrs.root-as-default-servlet=true}} maps applications at the 
context root to {{/}} as well, for applications that serve static files, JSPs 
or Faces views next to {{@ApplicationPath("/")}}.

Behaviour changes:
* Static files under an application path belong to the application; 
{{openejb.jaxrs.static-first}} is removed.
* For an application without a declared mapping, welcome-file processing 
(Servlet 6.0 ยง10.10) applies before JAX-RS to paths ending with {{/}}, so a 
welcome file mapped to a non-JSP servlet handles them.

Fixed along the way: unmatched paths return 404 instead of Tomcat's 405 for 
PUT/DELETE (TOMEE-4659), {{@ApplicationPath}} endpoints stay reachable next to 
a {{/*}} servlet (TOMEE-4481), {{@Context ServletConfig}} is injected, and 
endpoint deployments configured through {{cxf.jaxrs.*}} properties no longer 
answer 404. The JAX-RS TCK runs without replacing the default servlet.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to