Hi all,

Currently, the RedirectServlet (in the Sling Default GET Servlets
bundle) has special provision to return the current resource as JSON
according to the JsonRendererServlet. As such it has the following code
in the doGet method:

        // handle json export of the redirect node
        if (JsonRendererServlet.EXT_JSON.equals(
                request.getRequestPathInfo().getExtension())) {
            getJsonRendererServlet().service(request, response);
            return;
        }

The problem of this situation is, that this causes the RedirectServlet
and the DefaultGetServlet to both require configuration for the maximum
JSON result depth.

How about converting the RedirectServlet into a OptingServlet and
implement the accepts mehtod as follows:

    public boolean accepts(SlingHttpServletRequest request) {
        return !JsonRendererServlet.EXT_JSON.equals(
              request.getRequestPathInfo().getExtension());
    }

This would cause the RedirectServlet to be ignored for JSON requests and
instead have the redirect resource handled with the DefaultGetServlet.

WDYT ?

Regards
Felix

Reply via email to