You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Tobias Bocanegra <to...@day.com> on 2008/01/15 22:45:11 UTC

sling:include question

i want to include a script using a specific resource type, eg:

<sling:include path="<%= child.getPath %>"
resourceType="/apps/myapp/test/nav" />

if the resource exists, the include tag handler does not create a
syntetic one and it uses the resource type of the resource.
if i create a syntic resource myself:

<% SyntheticResource res = new SyntheticResource(child.getPath(),
"/apps/myapp/test/nav"); %>
<sling:include resource="<%= res %>"/>

this results in a NPE:

Caused by: java.lang.NullPointerException
	at org.apache.sling.usling.renderers.DefaultHtmlRenderer.render(DefaultHtmlRenderer.java:53)
	at org.apache.sling.usling.renderers.DefaultHtmlRendererServlet.doGet(DefaultHtmlRendererServlet.java:72)
	at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:261)
	
so my question is: how can i include a resource using a specific resource type?	

regards, toby
-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: sling:include question

Posted by Tobias Bocanegra <to...@day.com>.
> i want to include a script using a specific resource type, eg:
>
> <sling:include path="<%= child.getPath %>"
> resourceType="/apps/myapp/test/nav" />
>
> if the resource exists, the include tag handler does not create a
> syntetic one and it uses the resource type of the resource.
> if i create a syntic resource myself:
>
> <% SyntheticResource res = new SyntheticResource(child.getPath(),
> "/apps/myapp/test/nav"); %>
> <sling:include resource="<%= res %>"/>
>
> this results in a NPE:
>
> Caused by: java.lang.NullPointerException
>         at org.apache.sling.usling.renderers.DefaultHtmlRenderer.render(DefaultHtmlRenderer.java:53)
>         at org.apache.sling.usling.renderers.DefaultHtmlRendererServlet.doGet(DefaultHtmlRendererServlet.java:72)
>         at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:261)
>
> so my question is: how can i include a resource using a specific resource type?

found the solution myself: i need to specify the resource type relative:

<%  SyntheticResource res = new SyntheticResource(child.getPath(),
"myapp/test/nav");   %>

however, i think the include tag should to the exact same, then a path
and an explicit resource type is specified.

regards, toby
-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: sling:include question

Posted by Felix Meschberger <fm...@gmail.com>.
Thanks. Regards
Felix

Am Mittwoch, den 16.01.2008, 09:46 +0100 schrieb Tobias Bocanegra:
> ok:
> 
> SLING-162 NPE in DefaultHtmlRenderer if resource type not found via include
> SLING-163 Absolute resource types do no resolve
> 
> On 1/16/08, Felix Meschberger <fm...@gmail.com> wrote:
> > Hi Toby,
> >
> > This is actually two problems, probably: (1) absolute resource types are
> > not currently supported correctly and (2) the DefaultHtmlRender.render
> > should certainly not NPE.
> >
> > Could you please create JIRA's to not forget about it. Thanks.
> >
> > Regards
> > Felix
> >
> > Am Dienstag, den 15.01.2008, 22:45 +0100 schrieb Tobias Bocanegra:
> > > i want to include a script using a specific resource type, eg:
> > >
> > > <sling:include path="<%= child.getPath %>"
> > > resourceType="/apps/myapp/test/nav" />
> > >
> > > if the resource exists, the include tag handler does not create a
> > > syntetic one and it uses the resource type of the resource.
> > > if i create a syntic resource myself:
> > >
> > > <% SyntheticResource res = new SyntheticResource(child.getPath(),
> > > "/apps/myapp/test/nav"); %>
> > > <sling:include resource="<%= res %>"/>
> > >
> > > this results in a NPE:
> > >
> > > Caused by: java.lang.NullPointerException
> > >       at org.apache.sling.usling.renderers.DefaultHtmlRenderer.render(DefaultHtmlRenderer.java:53)
> > >       at org.apache.sling.usling.renderers.DefaultHtmlRendererServlet.doGet(DefaultHtmlRendererServlet.java:72)
> > >       at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:261)
> > >
> > > so my question is: how can i include a resource using a specific resource type?
> > >
> > > regards, toby
> >
> >
> 
> 


Re: sling:include question

Posted by Tobias Bocanegra <to...@day.com>.
ok:

SLING-162 NPE in DefaultHtmlRenderer if resource type not found via include
SLING-163 Absolute resource types do no resolve

On 1/16/08, Felix Meschberger <fm...@gmail.com> wrote:
> Hi Toby,
>
> This is actually two problems, probably: (1) absolute resource types are
> not currently supported correctly and (2) the DefaultHtmlRender.render
> should certainly not NPE.
>
> Could you please create JIRA's to not forget about it. Thanks.
>
> Regards
> Felix
>
> Am Dienstag, den 15.01.2008, 22:45 +0100 schrieb Tobias Bocanegra:
> > i want to include a script using a specific resource type, eg:
> >
> > <sling:include path="<%= child.getPath %>"
> > resourceType="/apps/myapp/test/nav" />
> >
> > if the resource exists, the include tag handler does not create a
> > syntetic one and it uses the resource type of the resource.
> > if i create a syntic resource myself:
> >
> > <% SyntheticResource res = new SyntheticResource(child.getPath(),
> > "/apps/myapp/test/nav"); %>
> > <sling:include resource="<%= res %>"/>
> >
> > this results in a NPE:
> >
> > Caused by: java.lang.NullPointerException
> >       at org.apache.sling.usling.renderers.DefaultHtmlRenderer.render(DefaultHtmlRenderer.java:53)
> >       at org.apache.sling.usling.renderers.DefaultHtmlRendererServlet.doGet(DefaultHtmlRendererServlet.java:72)
> >       at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:261)
> >
> > so my question is: how can i include a resource using a specific resource type?
> >
> > regards, toby
>
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: sling:include question

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Toby,

This is actually two problems, probably: (1) absolute resource types are
not currently supported correctly and (2) the DefaultHtmlRender.render
should certainly not NPE.

Could you please create JIRA's to not forget about it. Thanks.

Regards
Felix

Am Dienstag, den 15.01.2008, 22:45 +0100 schrieb Tobias Bocanegra:
> i want to include a script using a specific resource type, eg:
> 
> <sling:include path="<%= child.getPath %>"
> resourceType="/apps/myapp/test/nav" />
> 
> if the resource exists, the include tag handler does not create a
> syntetic one and it uses the resource type of the resource.
> if i create a syntic resource myself:
> 
> <% SyntheticResource res = new SyntheticResource(child.getPath(),
> "/apps/myapp/test/nav"); %>
> <sling:include resource="<%= res %>"/>
> 
> this results in a NPE:
> 
> Caused by: java.lang.NullPointerException
> 	at org.apache.sling.usling.renderers.DefaultHtmlRenderer.render(DefaultHtmlRenderer.java:53)
> 	at org.apache.sling.usling.renderers.DefaultHtmlRendererServlet.doGet(DefaultHtmlRendererServlet.java:72)
> 	at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:261)
> 	
> so my question is: how can i include a resource using a specific resource type?	
> 
> regards, toby