Hello Marius,

I could make the webservice and PoC works but I am not using the method 
$jsontool.serialize.

What is the impact if I not use this serialize method?

Ps.: I have updated the documentation.
http://dev.xwiki.org/xwiki/bin/view/Drafts/XWikiJSONWebServiceKickStart

Thanks.

Danilo



Grupo Energisa
Danilo Oliveira
Analista Suporte Aplicacao TI - DPTO CORP. DE INFRAESTR. TI
e-mail: danilo.olive...@energisa.com.br | tel: (32) 3429-6342 | cel: (32) 
8452-9478

Esta mensagem contém informação confidencial. Se você a recebeu por engano, não 
divulgue ou copie seu conteúdo. Por favor, avise ao remetente imediatamente e 
apague-a do computador.
Privileged and confidential. If this message has been received by mistake, do 
not disclose or copy its contents. Please notify sender and delete immediately.


-----Mensagem original-----
De: users [mailto:users-boun...@xwiki.org] Em nome de Marius Dumitru Florea
Enviada em: terça-feira, 20 de maio de 2014 08:14
Para: XWiki Users
Assunto: Re: [xwiki-users] Spatial Map Extension

On Mon, May 19, 2014 at 10:20 PM, Danilo Amaral de Oliveira 
<danilo.olive...@energisa.com.br> wrote:
> Hello People,
>
> We are planning to develop an extension that will link and show the documents 
> of a specific wiki spacially allowing the user explore the page dynamically. 
> The idea is similar to the "Just map it" extension.
>
> Our first step was to look some javascript framework available to draw the 
> relationships that could work for us and we came to conclusion that the 
> sigma.js or d3.js will work fine...
> But, I am worried with the data connection, how can I parse the data from the 
> DB to the extension dynamically?
>

> Do you think the kind of webservice bellow could work?
> dev.xwiki.org/xwiki/bin/view/Drafts/XWikiJSONWebServiceKickStart

The direction is ok, but:

* you should use the 'get' action instead of 'view' to access the webservice:

$xwiki.getURL('Main.WebService', 'get', $escapetool.url({
  'outputSyntax': 'plain',
  'limit': 10
}))

* the webservice should build the JSON in memory using plain Java objects 
(maps, lists, strings, numbers, boolean) and then serialize it. In Velocity you 
can use:

$jsontool.serialize({
  'foo': [1, 2, 3],
  'bar': {
    'color': 'red',
    enabled: true
  },
  'name': 'XWiki'
})

For writing the webservice I would start with Velocity and then move to Groovy 
but only if really needed.

Hope this helps,
Marius

>
> Thank you!
>
>
> Grupo Energisa
> Danilo Oliveira
> Analista Suporte Aplicacao TI - DPTO CORP. DE INFRAESTR. TI
> e-mail: danilo.olive...@energisa.com.br | tel: (32) 3429-6342 | cel:
> (32) 8452-9478
>
> Esta mensagem contém informação confidencial. Se você a recebeu por engano, 
> não divulgue ou copie seu conteúdo. Por favor, avise ao remetente 
> imediatamente e apague-a do computador.
> Privileged and confidential. If this message has been received by mistake, do 
> not disclose or copy its contents. Please notify sender and delete 
> immediately.
>
>
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to