Hi,

if you call sendError writing output is not allowed. From the spec:
"These methods [sendError, sendRedirect] will have the side effect of
committing the response, if it has
not already been committed, and terminating it. No further output to the client
should be made by the servlet after these methods are called. If data
is written to
the response after these methods are called, the data is ignored."

As it seems that Sling is handling the sendError call (to invoke the
error script) it should throw an exception when "All good" is tried to
be written..which results in calling the error script :)

Regards
Carsten

2013/2/1 Antonio Sanso <[email protected]>:
> Hi *,
>
> while working on SLING-2718 [0] I have noticed something that made me wonder.
> In particular if you see [1] I had to comment one line of my test in order to 
> pass it
>
>
>         public void test_500_errorhandling() throws IOException{
>                 final String expected = "Internal Server Error (500) - custom 
> error page";
>                 final String url =  testNodePath +SELECTOR_500+".html";
>                 assertContains(getContent(url, CONTENT_TYPE_HTML,null,500), 
> expected);
>                 //assertNotContains(getContent(url, 
> CONTENT_TYPE_HTML,null,200), "All good");
>         }
>
> In a nutshell it seems that if there is some servlet that is sending a 500 
> error (response.sendError(500)) and output something after e.g. "All good" 
> (maybe this is the wrong part...) and a 500.jsp exists, Sling will "show" 
> both:
>
> - the error page 500.jsp
> - and the the extra output (e.g. All good)
>
> Sorry if the questions sounds silly but is this normal or I might have hit 
> some bug?
>
> Regards
>
> Antonio
>
>
> [0]  https://issues.apache.org/jira/browse/SLING-2718
> [1] 
> https://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolver/errorhandler/ErrorHandlingTest.java



-- 
Carsten Ziegeler
[email protected]

Reply via email to