Java Apache Sling脚本解析规则是如何工作的?
我的内容中有一个名为Java Apache Sling脚本解析规则是如何工作的?,java,aem,sling,Java,Aem,Sling,我的内容中有一个名为tst的页面 sling:resourceType=新闻门户/页面/测试 页面结构(在/apps下): 测试有 sling:resourceSuperType=新闻门户/页面/新闻回购主页 在浏览器中,我键入以下URL: http://localhost:4502/cf#/content/tst.selector.pdf.html 在这个请求之后,我看到了selector.jsp 但我希望看到selector.pdf.jsp的内容,因为根据我的观点,它有更合适的内容 你能
tst
的页面
sling:resourceType=新闻门户/页面/测试
页面结构(在/apps
下):
测试有
sling:resourceSuperType=新闻门户/页面/新闻回购主页
在浏览器中,我键入以下URL:
http://localhost:4502/cf#/content/tst.selector.pdf.html
在这个请求之后,我看到了selector.jsp
但我希望看到selector.pdf.jsp
的内容,因为根据我的观点,它有更合适的内容
selector.pdf.jsp
内容的URLsling:resourceType
而不是吊索:resourceSuperType
还是一起?(我试着测试,但是
(看不见感情) 0 (2014-03-28 13:18:31) TIMER_START{Request Processing}
0 (2014-03-28 13:18:31) COMMENT timer_end format is {<elapsed msec>,<timer name>} <optional message>
0 (2014-03-28 13:18:31) LOG Method=GET, PathInfo=/content/tst.selector.pdf.html
0 (2014-03-28 13:18:31) TIMER_START{ResourceResolution}
0 (2014-03-28 13:18:31) TIMER_END{0,ResourceResolution} URI=/content/tst.selector.pdf.html resolves to Resource=JcrNodeResource, type=cq:Page, superType=null, path=/content/tst
0 (2014-03-28 13:18:31) LOG Resource Path Info: SlingRequestPathInfo: path='/content/tst', selectorString='selector.pdf', extension='html', suffix='null'
0 (2014-03-28 13:18:31) TIMER_START{ServletResolution}
0 (2014-03-28 13:18:31) TIMER_START{resolveServlet(JcrNodeResource, type=cq:Page, superType=null, path=/content/tst)}
0 (2014-03-28 13:18:31) TIMER_END{0,resolveServlet(JcrNodeResource, type=cq:Page, superType=null, path=/content/tst)} Using servlet /libs/foundation/components/primary/cq/Page/Page.jsp
0 (2014-03-28 13:18:31) TIMER_END{0,ServletResolution} URI=/content/tst.selector.pdf.html handled by Servlet=/libs/foundation/components/primary/cq/Page/Page.jsp
0 (2014-03-28 13:18:31) LOG Applying Requestfilters
0 (2014-03-28 13:18:31) LOG Calling filter: org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter
0 (2014-03-28 13:18:31) LOG Calling filter: org.apache.sling.rewriter.impl.RewriterFilter
0 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMRequestFilter
0 (2014-03-28 13:18:31) LOG Calling filter: org.apache.sling.i18n.impl.I18NFilter
0 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.theme.impl.ThemeResolverFilter
0 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet
1 (2014-03-28 13:18:31) LOG Calling filter: org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter
1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter
1 (2014-03-28 13:18:31) LOG RedirectFilter did not redirect (MobileUtil.isMobileResource() returns false)
1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.warp.TimeWarpFilter
1 (2014-03-28 13:18:31) LOG Applying Componentfilters
1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMComponentFilter
1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMDebugFilter
1 (2014-03-28 13:18:31) TIMER_START{/libs/foundation/components/primary/cq/Page/Page.jsp#0}
1 (2014-03-28 13:18:31) LOG Including resource JcrNodeResource, type=news-portal/pages/test, superType=null, path=/content/tst/jcr:content (SlingRequestPathInfo: path='/content/tst/jcr:content', selectorString='selector.pdf', extension='html', suffix='null')
1 (2014-03-28 13:18:31) TIMER_START{resolveServlet(JcrNodeResource, type=news-portal/pages/test, superType=null, path=/content/tst/jcr:content)}
1 (2014-03-28 13:18:31) TIMER_END{0,resolveServlet(JcrNodeResource, type=news-portal/pages/test, superType=null, path=/content/tst/jcr:content)} Using servlet /apps/news-portal/pages/news-repo-main-page/selector.jsp
1 (2014-03-28 13:18:31) LOG Applying Includefilters
1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMComponentFilter
1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMDebugFilter
1 (2014-03-28 13:18:31) TIMER_START{/apps/news-portal/pages/news-repo-main-page/selector.jsp#1}
2 (2014-03-28 13:18:31) LOG Found processor for post processing ProcessorConfiguration: {contentTypes=[text/html],order=-1, active=true, valid=true, processErrorResponse=true, pipeline=(generator=Config(type=htmlparser, config={}), transformers=(Config(type=linkchecker, config={}), Config(type=mobile, config=org.apache.sling.jcr.resource.JcrPropertyMap@25c0b221), Config(type=mobiledebug, config=org.apache.sling.jcr.resource.JcrPropertyMap@deea7e4), Config(type=contentsync, config=org.apache.sling.jcr.resource.JcrPropertyMap@2f5070e1), serializer=Config(type=htmlwriter, config={}))}
2 (2014-03-28 13:18:31) TIMER_END{1,/apps/news-portal/pages/news-repo-main-page/selector.jsp#1}
2 (2014-03-28 13:18:31) TIMER_END{1,/libs/foundation/components/primary/cq/Page/Page.jsp#0}
2 (2014-03-28 13:18:31) TIMER_END{2,Request Processing} Request Processing
我在Sling中看到了
pdf.jsp
的内容有两种:内容(存储在/content
下)和代码(存储在/apps
下)。内容仅包含属性数据。/content
下不应有逻辑、JSP(或任何其他代码)和选择器信息
另一方面,/apps
子树包含用于呈现内容的脚本。这种脚本通常称为组件<代码>吊索:resourceType属性(为一段数据设置,在/content
下)是内容和组件之间的链接。这就是内容可能会说“应该使用以下组件来显示我”的方式
sling:resourceSuperType
具有不同的功能。它是组件资源(在/apps
下)上设置的属性,用于标记此组件应继承JSP和其他JSP。此属性允许创建组件层次结构
根据注释中的链接,还可以在数据组件的/content
下放置sling:resourceSuperType
。在这种情况下,我们强制sling:resourceType
中引用的组件从sling:resourceSuperType
中引用的组件继承。我不知道这方面的任何用例,很难
在您的情况下,请尝试创建以下结构:
/content/test
=sling:resourceType
新闻门户/页面/测试
/apps/news portal/pages/test
- 组件主资源,无特殊属性
/apps/news portal/pages/test/test.jsp
- 主JSP文件
/apps/news portal/pages/test/selector.jsp
- 用于选择器的JSP
/apps/news portal/pages/test/selector/pdf.jsp
- 选择器+pdf扩展名
http://localhost:4502/cf#/content/tst.selector.pdf.html