Unable to set response code of 404 in map:handle-errors
-------------------------------------------------------

                 Key: COCOON-2218
                 URL: https://issues.apache.org/jira/browse/COCOON-2218
             Project: Cocoon
          Issue Type: Bug
          Components: * Cocoon Core, - Components: Sitemap, - Servlet service 
framework
    Affects Versions: 2.2-dev (Current SVN)
            Reporter: Robin Wyles


When an exception is thrown in a pipeline matcher, setting the response status 
code to 404 has no effect. A 200 is still returned.

Attached is a block illustrating this issue, run it with "mvn cocoon:prepare 
jetty:run", and call the following urls:

http://localhost:8888/status-test/matcher-not-found
Action: Calls a pattern that is not matched by any matcher in the sitemap. A 
ResourceNotFoundException is thrown and is handled by map:handle-errors which 
sets the status to 404.
Result: 404 status code is correctly returned.

http://localhost:8888/status-test/404
Action: Calls a matcher that reads a file, and serializes it setting the 
response code to 404. No error is thrown, we are simply setting a 404 in a 
matcher.
Result: 404 status code is correctly returned.

http://localhost:8888/status-test/file-not-found
Action: Calls a matcher that tries to read a non-existent file. A 
FileNotFoundException is thrown by the generator inside the matcher and is 
handled by map:handle-errors which sets the status to 404.
Result: 200 status code is incorrectly returned.

Please note that this issue only occurs when setting the status to 404, all 
other status codes seem to be handled correctly.

I've spent quite a while trying to debug this issue but I can't see the 
problem, in all cases it looks like the correct status is finally set by 
org.apache.cocoon.servletservice.HttpServletResponseBufferingWrapper.flushBufferedResponse.

I tried the suggestions given at http://www.mail-archive.com/[EMAIL 
PROTECTED]/msg42494.html but this had no effect.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to