AEM如何解决JSON扩展? [英] How does AEM resolve the JSON extension?
问题描述
在CQ中,如果我请求诸如 localhost:4502 / content / geometrixx / en.json
之类的资源,我将以JSON格式获取节点信息。 XML扩展名也是如此。
我的问题是,如果URL扩展名是 json $ c,它在哪里实现以JSON格式呈现节点信息。 $ c>?
基本上,扩展名只是文本和URL结构的另一部分。简单地添加 json
不会神奇地获取JSON格式的信息。
显然,人们必须使用此信息来编写逻辑以返回节点
In CQ, if I request a resource such as localhost:4502/content/geometrixx/en.json
, I would get the node information in JSON format. The same applies for the XML extension as well.
My question is, where is it implemented that the node information is rendered in JSON format if the URL extension is json
?
Basically, the extension is just simply text and another part of the URL structure. Simply appending json
won't magically fetch the information in JSON format.
Obviously, one would have to use this information to write logic for returning the node information in JSON.
我正在尝试了解CQ的内部工作原理。也许在Apache Sling中获取JSON的概念也一样?我不知道它是否特定于CQ,但要点是相同的。我也尝试过 / system / console / jcrresolver
,但这没有帮助。
I'm trying to learn about the internal workings of CQ. Maybe the concept of getting JSON is the same in Apache Sling as well? I don't know if it's CQ specific or not, but the point is same. I've tried /system/console/jcrresolver
as well, but it didn't help.
推荐答案
这是Apache Sling的功能。在所有GET请求上调用DefaultGetServlet。 servlet检查请求的扩展名并使用相应的渲染器(如果已启用)。
This is a function of Apache Sling. The DefaultGetServlet is invoked on all GET requests. The servlet checks the request's extension and uses the corresponding renderer if it's enabled.
浏览DefaultGetServlet 以及此<一个href = https://github.com/apache/sling/tree/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/helpers>目录,例如 HTML渲染器,JSON渲染器和 XML渲染器。
Look through the code of the 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
这篇关于AEM如何解决JSON扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!