You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ista Pouss <is...@gmail.com> on 2010/06/10 23:37:13 UTC

Get JSON with JcrRemotingServlet

Hi,

I read in the javadoc JcrRemotingServlet
(http://jackrabbit.apache.org/api/2.1/org/apache/jackrabbit/server/remoting/davex/JcrRemotingServlet.html)
it's possible to do a "batch read" - an HTTP GET I suppose ? in json
format.

Could you please give me an exemple, because I understand nothing. I
want to do an HTTP GET to get the value of a jcr node, and a response
in json format.

Thanks.

Re: Get JSON with JcrRemotingServlet

Posted by Ista Pouss <is...@gmail.com>.
2010/6/13, Alexander Klimetschek <ak...@day.com>:
> On Thu, Jun 10, 2010 at 23:37, Ista Pouss <is...@gmail.com> wrote:
>> Hi,
>>
>> I read in the javadoc JcrRemotingServlet
>> (http://jackrabbit.apache.org/api/2.1/org/apache/jackrabbit/server/remoting/davex/JcrRemotingServlet.html)
>> it's possible to do a "batch read" - an HTTP GET I suppose ? in json
>> format.
>>
>> Could you please give me an exemple, because I understand nothing. I
>> want to do an HTTP GET to get the value of a jcr node, and a response
>> in json format.
>
> Have you looked at Apache Sling? It provides a thin web application
> layer on top of JCR, including built-in servlets to retrieve nodes as
> JSON.
>
> http://sling.apache.org/
>

Yes, but according to javadoc of JcrRemotingServlet, there is same or
similar in JcrRemotingServlet :-) So I should want to understand how
works JcrRemotingServlet, because I use jackrabbit :-)

Thanks.

Re: Get JSON with JcrRemotingServlet

Posted by Alexander Klimetschek <ak...@day.com>.
On Thu, Jun 10, 2010 at 23:37, Ista Pouss <is...@gmail.com> wrote:
> Hi,
>
> I read in the javadoc JcrRemotingServlet
> (http://jackrabbit.apache.org/api/2.1/org/apache/jackrabbit/server/remoting/davex/JcrRemotingServlet.html)
> it's possible to do a "batch read" - an HTTP GET I suppose ? in json
> format.
>
> Could you please give me an exemple, because I understand nothing. I
> want to do an HTTP GET to get the value of a jcr node, and a response
> in json format.

Have you looked at Apache Sling? It provides a thin web application
layer on top of JCR, including built-in servlets to retrieve nodes as
JSON.

http://sling.apache.org/

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Get JSON with JcrRemotingServlet

Posted by Ista Pouss <is...@gmail.com>.
2010/6/15, Angela Schreiber <an...@day.com>:
>
> right
>
>> Could you please give me an exemple, because I understand nothing.
>
> nothing?
>

Middle nothing :-)


>
> did you already deploy the jackrabbit-webapp.war?
> this comes with some introduction and examples...
>

No, I used a maven project with my little webapp and jar dependencies.

Now I install jackrabbit-webapp.war, and I can run some json read and
write nodes thank you very much.

A question : I see in web.xml the servlet mapping for JCRWebdavServer
is /server/*. If I replace server by "foo", nothing work. I must also
replace "server" in resource-path-prefix in servlet JCRWebdavServer by
"foo". Why that ? Is it possible to have the prefix on the servlet
mapping automaticaly ?

Thanks.

Re: Get JSON with JcrRemotingServlet

Posted by Angela Schreiber <an...@day.com>.
hi ista

> I read in the javadoc JcrRemotingServlet
> (http://jackrabbit.apache.org/api/2.1/org/apache/jackrabbit/server/remoting/davex/JcrRemotingServlet.html)
> it's possible to do a "batch read" - an HTTP GET I suppose ? in json
> format.

right

> Could you please give me an exemple, because I understand nothing. 

nothing?

> I want to do an HTTP GET to get the value of a jcr node, and a response
> in json format.

what do you mean by 'get the value of a jcr node'?

did you already deploy the jackrabbit-webapp.war?
this comes with some introduction and examples...

http://yourhost:yourport/yourcontext/remoting/index.jsp

intro for batch read:
http://yourhost:yourport/yourcontext/remoting/read.jsp#batch_read

and a simple form to test it:
http://yourhost:yourport/yourcontext/remoting/read_batch.jsp

- type in the path of the node you want to be read
- define how many levels deep you want be included in the response
- and finally select the last param just for display purpose.

if you just want to read the value of a single property there
is no need for 'batch' reading... you simply request the property's
representation which in case of the jcr-remoting is a separate
dav resource (non-collection).

hope that helps.

regards
angela

> 
> Thanks.
>