You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Phil Rice <ph...@googlemail.com> on 2011/07/16 16:00:52 UTC

Querying Sling for child nodes without setting sling:resourceType

Thanks to the help I received from this mailing list,I am happily
posting data into sling, and retrieving it with java queries. I have
made several JSP fragments, and everything is working well. So for
example, I am now able to make the list.jsp examples, which list me
the child nodes under 'this' node, as long as the node has a
sling:resourceType.

I would like to write a simple browser that fulfills the role that the
jcr:explorer should. (the jcr:explorer project is sadly not working
within launchpad. As you soon as you update a property such as
sling:resourceType it dies. If you want I will raise a defect for
this). To write my browser I have to be able to find the child nodes
of an arbitrary node. With the small knowledge I have to date, this
could be done if I guarantee that every node has the same
sling:resourceType, as I could then write a MyList.jsp for that
sling:resourceType. However I would like to increase my Sling-fu, and
this seems like a good starter project.

There is clearly a way to do this: the extensions .json/.xml/.html are
using it. Is there a way to write my own equivalent so that I could
call (say) http://localhost:8080/content.myList, and this be
rediverted to MyList.jsp?

The other approach I have is to go in through the webdav interface,
and query for children. Do any of you have any suggestions for good
reference material on how to do this?

Thanks again for the help

Re: Querying Sling for child nodes without setting sling:resourceType

Posted by Phil Rice <ph...@googlemail.com>.
That was exactly what I was after thank you

On Sat, Jul 16, 2011 at 4:34 PM, Eric Norman <er...@gmail.com> wrote:
> Hi Phil,
>
> If you want a script that works for all resource types, then you probably
> would want to register your scripts under the special 'sling/servlet/default'
> resource type.
>
> This is briefly described here:
> http://sling.apache.org/site/servlets.html#Servlets-DefaultServlet%28s%29
>
> Regards,
> Eric
>
> On Sat, Jul 16, 2011 at 7:00 AM, Phil Rice <phil.rice.erudine@googlemail.com
>> wrote:
>
>> Thanks to the help I received from this mailing list,I am happily
>> posting data into sling, and retrieving it with java queries. I have
>> made several JSP fragments, and everything is working well. So for
>> example, I am now able to make the list.jsp examples, which list me
>> the child nodes under 'this' node, as long as the node has a
>> sling:resourceType.
>>
>> I would like to write a simple browser that fulfills the role that the
>> jcr:explorer should. (the jcr:explorer project is sadly not working
>> within launchpad. As you soon as you update a property such as
>> sling:resourceType it dies. If you want I will raise a defect for
>> this). To write my browser I have to be able to find the child nodes
>> of an arbitrary node. With the small knowledge I have to date, this
>> could be done if I guarantee that every node has the same
>> sling:resourceType, as I could then write a MyList.jsp for that
>> sling:resourceType. However I would like to increase my Sling-fu, and
>> this seems like a good starter project.
>>
>> There is clearly a way to do this: the extensions .json/.xml/.html are
>> using it. Is there a way to write my own equivalent so that I could
>> call (say) http://localhost:8080/content.myList, and this be
>> rediverted to MyList.jsp?
>>
>> The other approach I have is to go in through the webdav interface,
>> and query for children. Do any of you have any suggestions for good
>> reference material on how to do this?
>>
>> Thanks again for the help
>>
>

Re: Querying Sling for child nodes without setting sling:resourceType

Posted by Eric Norman <er...@gmail.com>.
Hi Phil,

If you want a script that works for all resource types, then you probably
would want to register your scripts under the special 'sling/servlet/default'
resource type.

This is briefly described here:
http://sling.apache.org/site/servlets.html#Servlets-DefaultServlet%28s%29

Regards,
Eric

On Sat, Jul 16, 2011 at 7:00 AM, Phil Rice <phil.rice.erudine@googlemail.com
> wrote:

> Thanks to the help I received from this mailing list,I am happily
> posting data into sling, and retrieving it with java queries. I have
> made several JSP fragments, and everything is working well. So for
> example, I am now able to make the list.jsp examples, which list me
> the child nodes under 'this' node, as long as the node has a
> sling:resourceType.
>
> I would like to write a simple browser that fulfills the role that the
> jcr:explorer should. (the jcr:explorer project is sadly not working
> within launchpad. As you soon as you update a property such as
> sling:resourceType it dies. If you want I will raise a defect for
> this). To write my browser I have to be able to find the child nodes
> of an arbitrary node. With the small knowledge I have to date, this
> could be done if I guarantee that every node has the same
> sling:resourceType, as I could then write a MyList.jsp for that
> sling:resourceType. However I would like to increase my Sling-fu, and
> this seems like a good starter project.
>
> There is clearly a way to do this: the extensions .json/.xml/.html are
> using it. Is there a way to write my own equivalent so that I could
> call (say) http://localhost:8080/content.myList, and this be
> rediverted to MyList.jsp?
>
> The other approach I have is to go in through the webdav interface,
> and query for children. Do any of you have any suggestions for good
> reference material on how to do this?
>
> Thanks again for the help
>