jungm opened a new pull request, #3064:
URL: https://github.com/apache/tomee/pull/3064

   Fixes [TOMEE-4728](https://issues.apache.org/jira/browse/TOMEE-4728)
   
   ## Summary
   
   A webapp declaring `@ApplicationPath("/api")` with its own pre-matching 
filter in `getClasses()` gets the MicroProfile Health endpoint (TOMEE-4716) in 
a separate container application at `/`. That application was deployed with the 
providers collected from the declared applications, so the filter ran for 
`/health` too.
   
   ```diff
    RESTService.deployApplications
      additionalProviders = webapp-wide providers
   +  webAppProviders = copy of additionalProviders
      for each declared Application
        additionalProviders += its getClasses()/getSingletons() providers
        deploy it with additionalProviders
      if no declared Application at "/" and container resources exist
   -    deploy InternalApplication(health) with additionalProviders
   +    deploy InternalApplication(health) with webAppProviders
   ```
   
   ## Evidence
   
   `HealthEndpointTest.applicationWithItsOwnProvider` 
(`tomee-microprofile-itests`):
   
   ```text
   deploy @ApplicationPath("/api") listing HelloResource + @PreMatching filter 
aborting with 503
   GET /test/api/hello   → 503   (filter applies in its own application)
   GET /test/health      → 200
   GET /test/health/live → 200
   ```
   
   - **Before:** `HealthEndpointTest.applicationWithItsOwnProvider:139 
expected:<200> but was:<503>`
     **After:** green, with the rest of `tomee-microprofile-itests` (12 tests), 
`microprofile-jwt-itests` (51, 3 skipped), `openejb-rest` and `openejb-cxf-rs`
   
   ## Merge Danger
   
   **Door:** two-way
   
   **Blast Radius:** health-endpoint
   
   Only the container application deployed next to declared applications not at 
`/` changes, which means MicroProfile distributions with health. Webapp-wide 
(scanned) providers still apply to it. A provider that a declared application 
lists only in its own `getClasses()`/`getSingletons()` no longer runs for 
`/health`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to