Reputation: 37034
I have page with name tst
in content whose
sling:resourceType = news-portal/pages/test
page structure (under the /apps
):
test has
sling:resourceSuperType = news-portal/pages/news-repo-main-page
in browser I type following URL:
http://localhost:4502/cf#/content/tst.selector.pdf.html
after this request I see content of selector.jsp
But I expected to see content of selector.pdf.jsp
because it has more suitable much according my opinion.
Can you explain how it works?
Is there URL which can show content of selector.pdf.jsp
?
sling:resourceType
instead of sling:resourceSuperType
or together? (I try to test but
don't see affection)P.S.
I know that answer somewhere here:
But I have problems with understanding
P.S.
log resolving:
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
I noticed that if I create following structure and send request to
http://localhost:4502/cf#/content/tst.selector.pdf.html
I see content of pdf.jsp
Upvotes: 6
Views: 3669
Reputation: 9304
In Sling there are two things: content (stored under /content
) and code (stored under /apps
). Content contains only properties data. There should be no logic, no JSP (or any other code) and selector information under /content
.
On the other hand, /apps
subtree contains scripts used to render the content. Such scripts are usually called components. sling:resourceType
property (set for a piece of data, under /content
) is a link between content and component. This is the way how content may say "following component should be used to display me".
sling:resourceSuperType
has a different function. It is a property set on the component resource (under /apps
), used to mark that this component should inherit JSPs and from another one. This property allows to create component hierarchy.
According to link in the comment it is also possible to put sling:resourceSuperType
in the data component under /content
. In this case, we force the component referenced in sling:resourceType
to inherit from component referenced in sling:resourceSuperType
. I don't know any use-case for that, tough.
In your case, please try creating following structure:
/content/test
sling:resourceType
= news-portal/pages/test
/apps/news-portal/pages/test
/apps/news-portal/pages/test/test.jsp
/apps/news-portal/pages/test/selector.jsp
/apps/news-portal/pages/test/selector/pdf.jsp
Upvotes: 7