rombert commented on PR #68:
URL: 
https://github.com/apache/sling-org-apache-sling-engine/pull/68#issuecomment-3836004814

   > Shouldn't this kind of fallback rather be implemented in Sling Models 
(i.e. register the Model for both servlet request types). Having this for all 
kind of adaptations feels too magic to me.
   
   BTW, this is what 
https://github.com/apache/sling-org-apache-sling-models-impl/pull/77 aims to do 
and it is not enough:
   - we need to handle regular adaptables, not only only Sling Models
   - when running in a Jakarta environment, the 
`SlingHttpServletRequest.adaptTo` call delegates to the actual impl from the 
Sling Engine, which is a Jakarta impl, therefore only considering adapter 
factories that adapt from the `SlingJakartaHttpServletRequest`, leading to this 
problem. 
   
   One possible alternative would be to add a `ServiceListener` which registers 
adapter factories for all adapters from `SlingHttpServlet(Request|Response)` to 
match their Jakarta counterparts. I haven't tested it that works but for me it 
has the same degree of 'magic' and the code would be more complicated. I took 
this kind of approach in 
https://github.com/apache/sling-org-apache-sling-servlets-post/pull/33, but 
only because the existing infrastructure already existed; I don't think we 
should go that way unless we have strong reasons.


-- 
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