You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Willis C White <wh...@us.ibm.com> on 2009/06/19 16:41:12 UTC

sending objects to client browser

I want to send a data object to a client (web page) what is the best 
binding to use for this? 

Currently I am using the jsonrpc binding with dojo but I am not sure how 
to move from sending a String to sending a object. Do I change bindings or 
try to represent the data object (stings and integers) as a supported 
type?

In looking at this page: 
http://tuscany.apache.org/sca-java-bindingjsonrpc.html
The JSON-RPC binding utilize the Databinding Framework to provide support 
for the following data transformations :
Primitive Type <==> JSON <==> Primitive Type 
Array of Primitive Type <==> JSON <==> Array of Primitive Type 
Java bean <==> JSON <==> Java bean 
List <==> JSON <==> List 
Map <==> JSON <==> Map 
Set <==> JSON <==> Set 
 
Could one of theses be used to represent a data object.




Willis C White III 
IQ Technology Projects
IBM CIO Technology & Innovation
Home office 845 331-5134
Cell 845 853-3827
 

 

Re: sending objects to client browser

Posted by Simon Laws <si...@googlemail.com>.
On Fri, Jun 19, 2009 at 3:41 PM, Willis C White<wh...@us.ibm.com> wrote:
>
> I want to send a data object to a client (web page) what is the best binding
> to use for this?
>
> Currently I am using the jsonrpc binding with dojo but I am not sure how to
> move from sending a String to sending a object. Do I change bindings or try
> to represent the data object (stings and integers) as a supported type?
>
> In looking at this page:
> http://tuscany.apache.org/sca-java-bindingjsonrpc.html
> The JSON-RPC binding utilize the Databinding Framework to provide support
> for the following data transformations :
>
> Primitive Type <==> JSON <==> Primitive Type
> Array of Primitive Type <==> JSON <==> Array of Primitive Type
> Java bean <==> JSON <==> Java bean
> List <==> JSON <==> List
> Map <==> JSON <==> Map
> Set <==> JSON <==> Set
>
>
> Could one of theses be used to represent a data object.
>
>
> Willis C White III
> IQ Technology Projects
> IBM CIO Technology & Innovation
> Home office 845 331-5134
> Cell 845 853-3827
>
>

Hi Willis

If you create POJOs to represent the complex types on your service
interface the jsonrpc binding should be able to marshal/unmarshal
these for you. See [1] for an example service implementation. In this
particular case the POJOs are generated SDOs but can just hand craft
POJOs.

Regards

Simon

[1] http://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java