If you the JSON string is coming from somewhere else and you really
have no choice, then it may be worthwhile to put together a JSO
Overlay, use the Overlay to instantiate a POJO on the client side
code, and send the POJO to the server via GWT RPC.
Since your new some of that probably makes no sense, and If you can
give a little more detail as to why you need to have JSON originating
from the client I'm sure this can be explained a bit better to fit
your case.
GWT-RPC: http://code.google.com/webtoolkit/doc/latest/tutorial/RPC.html
GWT-JSON: http://code.google.com/webtoolkit/doc/latest/tutorial/JSON.html#client
2010/6/16 Jose Luis Estrella Campaña <jleca...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
private final native JsArray<StockData> asArrayOfStockData(String json) /*-{ return eval(json); }-*/;
private final native JsArray<StockData> asArrayOfStockData(String json) /*-{ return $wnd.JSON.parse(json); }-*/;
2010/6/18 Jose Luis Estrella Campaña <jleca...@gmail.com>:
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
Simple is better...
Adding those source tags to your gwt.xml file tells GWT that those
classes need to be available client side. Hence why you wont find the
'server' package in that file, as it's server side code only. By
accessing a class in shared from the server side code, it will get
compiled and be available for you.
The rest is all done for you when GWT creates the MyServiceAsync class
which you define the interface for, and within the
RemoteServiceServlet which your Servlet extends.
I think it would be a worthwhile experiment to see if and how much of
a difference there is between using GWT-RPC and using JSON with
Overlay Types.
Just to throw another option into the mix you could roll your own RPC
interface using GWT Generators like GWT does.
While we're on the subject of GWT-RPC, are you locked into using a
Servlet on the server side? Is there some binary format that GWT
converts to for serialization, or is it simply producing a JSON string
and decoding it in RemoteServiceServlet.
2010/6/19 Jose Luis Estrella Campaña <jleca...@gmail.com>:
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.