[ https://issues.apache.org/jira/browse/SLING-7836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17180804#comment-17180804 ]
Eric Norman commented on SLING-7836: ------------------------------------ Integration test added to confirm the fix at: [https://github.com/apache/sling-org-apache-sling-launchpad-integration-tests/commit/ce66b636685295fc467f3cc78f6ae66817db2a85] > 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 > Priority: Major > Fix For: Servlets Resolver 2.7.6 > > > 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 (v8.3.4#803005)