AEM 如何解析 JSON 扩展名?

How does AEM resolve the JSON extension?

在CQ中,如果我请求localhost:4502/content/geometrixx/en.json这样的资源,我会得到JSON格式的节点信息。这同样适用于 XML 扩展。
我的问题是,如果URL扩展名是json,节点信息以JSON格式呈现是在哪里实现的? 基本上,扩展只是简单的文本和 URL 结构的另一部分。简单地附加 json 不会神奇地获取 JSON 格式的信息。
显然,必须使用此信息来编写用于返回 JSON.

中的节点信息的逻辑。

我正在尝试了解 CQ 的内部工作原理。也许获取 JSON 的概念在 Apache Sling 中也是一样的?我不知道它是否特定于 CQ,但重点是一样的。我也试过 /system/console/jcrresolver,但没用。

这是 Apache Sling 的功能。 DefaultGetServlet 在所有 GET 请求上被调用。 servlet 检查请求的扩展名并使用相应的渲染器(如果已启用)。

查看DefaultGetServlet and as well as the renderers in this directory such as the HTML renderer, JSON renderer and XML renderer的代码。

文档位于此处:https://sling.apache.org/documentation/bundles/rendering-content-default-get-servlets.html