save the following as  uuid.jsp

=8<==

<%--
uuid.jsp
--%>
<%@page session="false"
import="javax.jcr.Node"
trimDirectiveWhitespaces="true"%>
<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
<sling:defineObjects/>
<%= resource.adaptTo(Node.class).getIdentifier() %>

=8<==


and execute the following commands (assuming sling runs on port 4502):

curl -u admin:admin -F_charset_=utf-8 -F"jcr:primaryType=nt:folder"
http://localhost:4502/apps/sling
curl -u admin:admin -F_charset_=utf-8 -F"jcr:primaryType=nt:folder"
http://localhost:4502/apps/sling/servlet
curl -u admin:admin -F_charset_=utf-8 -F"jcr:primaryType=sling:Folder"
http://localhost:4502/apps/sling/servlet/default
curl -u admin:admin -T uuid.jsp
http://localhost:4502/apps/sling/servlet/default/uuid.jsp


Then you should be able to make requests

GET /some/node/path.uuid.html

to get uuid of /some/node/path



On Tue, Jun 26, 2012 at 12:11 PM, Justin Edelson
<[email protected]>wrote:

> If the Node has the mix:referenceable mixin, you should see the UUID in the
> JSON output.
>
> Justin
>
> On Tue, Jun 26, 2012 at 11:58 AM, Bhathiya Jayasekara <
> [email protected]
> > wrote:
>
> > Hi,
> >
> > Thank you for the reply. As I understand, what you say is to write an esp
> > or something in server side to get UUID and respond to an http request.
> > Correct me if I'm wrong.
> >
> > Isn't there a direct way to do this only with a simple http request?
> > Someway like in this[1] cheatsheet? I mean isn't it already implemented
> in
> > sling server?
> >
> > Thank you.
> >
> >  --Bhathiya
> >
> > [1]
> >
> >
> http://dev.day.com/content/ddc/blog/2008/07/cheatsheet/_jcr_content/par/download/file.res/cheatsheet.pdf
> >
> > On Tue, Jun 26, 2012 at 8:23 PM, sam ” <[email protected]> wrote:
> >
> > > resource.adaptTo(Node.class).getIdentifier()
> > >
> > > On Tue, Jun 26, 2012 at 10:48 AM, Bhathiya Jayasekara <
> > > [email protected]
> > > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > How can I get the UUID of a Node with an http request? I searched a
> lot
> > > but
> > > > had no luck. :(
> > > >
> > > > Thank you.
> > > >
> > > >  --Bhathiya
> > > >
> > >
> >
> >
> >
> > --
> > -Bhathiya Jayasekara-
> > http://www.google.com/profiles/tobhathiyaj
> > http://www.facebook.com/#!/bhathiyaj1
> >
>

Reply via email to