Eric Norman created SLING-7836:
----------------------------------
Summary: Resolving the error handling scripts should consider the
request file extension
Key: SLING-7836
URL: https://issues.apache.org/jira/browse/SLING-7836
Project: Sling
Issue Type: Improvement
Affects Versions: Servlets Resolver 2.4.20, Launchpad Integration Tests
1.0.6
Reporter: Eric Norman
Assignee: Eric Norman
I am expecting that a request to [http://localhost:8080/bogus.json] should
return a JSON response with the 404 error details in JSON when the resource
doesn't exist. (also similar behavior should be possible for a .txt or .xml
file extension)
What I see currently is that SlingServletResolver#handleError ignores the
incoming file extension and always returns the error page as html.
I would expect that an "errorhandler" script/servlet registered with
("sling.servlet.resourceTypes=sling/servlet/errorhandler",
"sling.servlet.extensions=json", "sling.servlet.methods=404") should be
preferred when the incoming request has a .json extension, and then use the
original html error response as a fallback for all other scenarios.
Basically the client should get JSON back when something goes wrong instead of
html that won't parse as JSON.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)