在adobe AEM (又名cq)中,对于给定的url,可以看到正在调用哪些jsp吗?
我们有示例代码,不是我们写的,如果存在或不存在特定的选择器,则匹配两组'base‘jsp - 'm’表示移动端。在基本jsp中,如果移动或桌面设备正在请求,则将变量设置为标志。
从那时起,不再使用选择器-只检查变量以明确包含特定于移动设备的jsp。
这是一种不同于仅使用选择器来调用或不调用特定jsp的方法。
通过跟踪脚本解析,它有助于可视化和首次亮相,但这是基于sling的代码的常见模式吗?
发布于 2013-09-15 02:47:02
您可以在Web控制台的recent requests选项卡中查看最近请求的详细信息(本地author实例为http://localhost:4502/system/console/requests )。
输出类似于下面的输出,它应该会为您提供足够的信息
0 (2013-09-14 21:36:20) TIMER_START{Request Processing}
0 (2013-09-14 21:36:20) COMMENT timer_end format is {<elapsed msec>,<timer name>} <optional message>
0 (2013-09-14 21:36:20) LOG Method=GET, PathInfo=/.edit.html
0 (2013-09-14 21:36:20) TIMER_START{ResourceResolution}
1 (2013-09-14 21:36:20) TIMER_END{1,ResourceResolution} URI=/.edit.html resolves to Resource=JcrNodeResource, type=sling:redirect, superType=null, path=/
1 (2013-09-14 21:36:20) LOG Resource Path Info: SlingRequestPathInfo: path='/', selectorString='edit', extension='html', suffix='null'
1 (2013-09-14 21:36:20) TIMER_START{ServletResolution}
1 (2013-09-14 21:36:20) TIMER_START{resolveServlet(JcrNodeResource, type=sling:redirect, superType=null, path=/)}
1 (2013-09-14 21:36:20) TIMER_END{0,resolveServlet(JcrNodeResource, type=sling:redirect, superType=null, path=/)} Using servlet /libs/sling/servlet/default/edit.jsp
1 (2013-09-14 21:36:20) TIMER_END{0,ServletResolution} URI=/.edit.html handled by Servlet=/libs/sling/servlet/default/edit.jsp
1 (2013-09-14 21:36:20) LOG Applying Requestfilters
1 (2013-09-14 21:36:20) LOG Calling filter: org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter
1 (2013-09-14 21:36:20) LOG Calling filter: org.apache.sling.explorer.post.POSTServletFilter
1 (2013-09-14 21:36:20) TIMER_START{/libs/sling/servlet/default/edit.jsp#0}
3 (2013-09-14 21:36:20) LOG Including resource JcrNodeResource, type=sling:redirect, superType=null, path=/ (SlingRequestPathInfo: path='/', selectorString='head', extension='html', suffix='null')
3 (2013-09-14 21:36:20) TIMER_START{resolveServlet(JcrNodeResource, type=sling:redirect, superType=null, path=/)}
3 (2013-09-14 21:36:20) TIMER_END{0,resolveServlet(JcrNodeResource, type=sling:redirect, superType=null, path=/)} Using servlet /libs/sling/servlet/default/head.jsp发布于 2013-09-15 22:43:19
您还可以使用ServletResolver服务找出哪个脚本或servlet将处理请求:
Servlet servlet = servletResolver.resolveServlet(slingRequest);
RequestUtil.getServletName(servlet);发布于 2013-09-16 15:47:22
如@robert_munteanu所示,系统控制台上的requests选项卡是跟踪请求处理的最佳位置。
这是Sling应用程序中的常见习惯用法。不同的JSP用于GET/POST请求、包含选择器的请求或具有不同扩展名的请求。
看一看Sling Cheatsheet,了解它在高层次上是如何工作的,或者看一下Sling ScriptSelectionTest单元测试,它探索了更广泛的用例。
https://stackoverflow.com/questions/18799650
复制相似问题