[
https://issues.apache.org/jira/browse/SLING-7836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Norman resolved SLING-7836.
--------------------------------
Resolution: Fixed
Fixed at
[https://github.com/apache/sling-org-apache-sling-servlets-resolver/commit/5099b932515283578c3886f39ceef17ad86136fc]
> 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: Launchpad Integration Tests 1.0.6, Servlets Resolver
> 2.4.20
> 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)