Hi I have the guts feeling that the Sling error handling mechanism should not do anything. Rather we should expect the error handler script to set the status appropriately.
OTOH the Servlet API states that the setStatus is actually disabled when calling the error handling JSP (if it is a JSP) and thus probably implies that the servlet container presets the status to the actual status code and doesn’t allow the error handler to change it. I am not really sure, whether we should actually go as far as setting the status in the Sling error handling before calling the actual error handler and then disable setStatus ... Regards Felix > Am 08.11.2014 um 11:53 schrieb Carsten Ziegeler <[email protected]>: > > Am 07.11.14 um 18:32 schrieb Bertrand Delacretaz: >> On Fri, Nov 7, 2014 at 5:03 PM, Carsten Ziegeler <[email protected]> >> wrote: >>> Am 07.11.14 um 16:21 schrieb Bertrand Delacretaz: >>>> ... I think we should set a non-200 HTTP status if an error handler script >>>> does not set the it, what do people think? >>>> >>> I'm not sure - I would imagine that if an error handler can handle the >>> error and return a "correct" response, 200 would be a valid status... >> >> We could wrap the response's setStatus (and related) methods so as to >> detect whether the script has explicitly set a status, and if not set >> one. >> > The point is, if a handler creates a valid response it does not call > setStatus with the 200 value as it simply assumes that this is the > status anyway. > > So I think we should leave it up to the error handler to correctly > handle the status and not try to be smarter than everyone else. > > Carsten > >> Or, if calling response.setStatus several times is allowed (I think >> that's the case but haven't tried) simply make an initial call to that >> setting the status that the error handler is called for. >> >> -Bertrand >> > > > -- > Carsten Ziegeler > Adobe Research Switzerland > [email protected]
