Re: JSON to Client Side GWT JavaScriptObject

2016-09-22 Thread Velusamy Velu
Thank you very much! I just can't believe I missed that.

On Thursday, September 22, 2016 at 11:10:15 AM UTC-4, Jens wrote:
>
> Missing "return" statement in your JSNI method. Because you returned 
> nothing, the method returns null automatically.
>
> Also you can use 
>
> ServerResponseJson resp = JsonUtils.safeEvel(jsonString);
>
> which is safer than using JS eval() directly.
>
> -- J.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: JSON to Client Side GWT JavaScriptObject

2016-09-22 Thread Jens
Missing "return" statement in your JSNI method. Because you returned 
nothing, the method returns null automatically.

Also you can use 

ServerResponseJson resp = JsonUtils.safeEvel(jsonString);

which is safer than using JS eval() directly.

-- J.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: JSON JsDate/Date encode/decode with restyGWT

2015-02-04 Thread Juan Calderón
Thanks,

The mapping java.util.Date <> JSON is automatic; so, I was wrong because 
JsDate is not necessary :)

Le lundi 26 janvier 2015 12:14:11 UTC-7, Jens a écrit :
>
> Probably better asked on a restyGWT forum or on their Github issue tracker.
>
> But I guess you have to use java.util.Date on client and server or you 
> have to extend restyGWT so it knows how to map JsDate <-> Date.
>
> -- J.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: JSON JsDate/Date encode/decode with restyGWT

2015-01-26 Thread Jens
Probably better asked on a restyGWT forum or on their Github issue tracker.

But I guess you have to use java.util.Date on client and server or you have 
to extend restyGWT so it knows how to map JsDate <-> Date.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: JSON to ValueProxy

2014-07-10 Thread Vasu
If you are looking to generate OverlayTypes. I have created one maven 
plugin which can generate OverlayType but it will generate it from Server 
side Java Bean class and not from Json. You have to add few annotation and 
this plugin will do the job. refer following 
project https://github.com/pandurangpatil/gwt-mvn-helper. You will find a 
sample inside mvn-helper-test module. This plugin is more helpful if you 
are using Request Factory.


[image: Pandurang Patil on about.me] 
Pandurang Patil
about.me/pandurangpatil
  
website: http://www.agnie.net
twitter: @agniesoftware
Cell : +91-9823241535

On Thursday, 10 July 2014 15:04:03 UTC+5:30, trayan@agilemates.com 
wrote:
>
> Is there some way using AutonBean.decode to convert standart json -> 
> "{name : "Some name"}" to 
>
> class NameProxy extends ValueProxy{
>   String getName();
>
>  void setName(String name);
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: JSON+RequestBuilder vs RequestFactory

2013-11-02 Thread m1kema
Hello zixzigma,

Did you ever come up with a resolution here ?

I'm new to GWT, and we currently have a Spring MVC backend, that we would 
like to communicate with. 

Were you able to integrate which such a backend ?   if so, which option(s) 
did you go with, and do you have any example of such ?

Thanks for any help that you may be able to provide.

- Mike

On Wednesday, November 17, 2010 1:59:55 AM UTC-6, zixzigma wrote:
>
> Hello everyone. 
>
> What are the benefits of using RequestFactory over JSON/Request 
> Builder. 
>
> to implement client-side communication/persistence i have to options: 
>
> 1- using Spring/Spring MVC on the server to handle all the server-side 
> work, 
> and send JSON data to the GWT client. 
>
> 2- i believe I still can use SpringMVC with RequestFactory, though not 
> as cleanly seperated as the first approach. 
>
> all the code will be in Java. 
>
> What are the benefits of using RequestFactory over JSON/ 
> RequestBuilder ? 
>
>
> Thank You

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: JSON+RequestBuilder vs RequestFactory

2013-11-02 Thread m1kema
Not sure if my first question went in ... Checking to see, if you were able 
to come up with a resolution to your question ?

We have an existing Spring MVC backend, that we would like to hook up to an 
GWT front-end.  Have similar questions/issues in terms of how
we would like to communicate with backend (e.g., RequestBuilder, 
RequestFactory, etc) and if it is possible for GWT and Spring MVC to 
co-exist.

Thanks,
Mike

On Wednesday, November 17, 2010 1:59:55 AM UTC-6, zixzigma wrote:
>
> Hello everyone. 
>
> What are the benefits of using RequestFactory over JSON/Request 
> Builder. 
>
> to implement client-side communication/persistence i have to options: 
>
> 1- using Spring/Spring MVC on the server to handle all the server-side 
> work, 
> and send JSON data to the GWT client. 
>
> 2- i believe I still can use SpringMVC with RequestFactory, though not 
> as cleanly seperated as the first approach. 
>
> all the code will be in Java. 
>
> What are the benefits of using RequestFactory over JSON/ 
> RequestBuilder ? 
>
>
> Thank You

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: JSON object to AutoBean via JSNI in DevMode

2013-08-27 Thread Jens

>
> Use native JSON.stringify through JSNI?
> The problem with com.google.gwt.json is that it creates a lot of objects 
> and uses a lot of JSNI which slows down DevMode.
>

Ok JSON.stringify helps quite a bit. Now its basically

if (GWT.isScript()) {
  dataBean = AutoBeanCodex.decode(factory, Data.class, (JsoSplittable) 
getDataAsJsoFromJSNI());
} else {  
  //JsoSplittable is @GwtScriptOnly so we need something different for 
DevMode
  dataBean = AutoBeanCodex.decode(factory, AppInitData.class, 
getDataAsStringFromJSNI());
}




(side note: the data you get from the page is JS, not JSON; JSON is a 
> serialization format, if you have objects, then it's JS, possibly expressed 
> as JS literals; this is one reason why JSON-P is completely misnamed: 
> there's no JSON in JSON-P, at all)
>

Yeah of course I get a JSO. Just a bad habit when naming it directly JSON.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: JSON object to AutoBean via JSNI in DevMode

2013-08-27 Thread Thomas Broyer


On Tuesday, August 27, 2013 10:21:28 AM UTC+2, Jens wrote:
>
> Hi,
>
> is there anything faster than
>
> final String payload = new JSONObject(jsonDataFromJSNI).toString();
> dataBean = AutoBeanCodex.decode(factory, Data.class, payload);
>
> when in DevMode? The JSON data is embedded into the host page and not that 
> tiny (worst case ~600kb uncompressed) and the above solution makes DevMode 
> hang for about 3-5 seconds when refreshing the site. Thats kind of annoying 
> and I just want to make sure I didn't miss a different solution for DevMode 
> thats maybe faster.
>

Use native JSON.stringify through JSNI?
The problem with com.google.gwt.json is that it creates a lot of objects 
and uses a lot of JSNI which slows down DevMode.


If you don't mind running a patched GWT, there are a few issues that need 
to be fixed (most of them have pending reviews):

   - Elemental JSON can't be used without bringing the whole Elemental (which 
   breaks 
DevMode
   ): https://gwt-review.googlesource.com/4210
   - Some of Elemental JSON is broken in prod mode (OK, not really relevant 
   here): https://gwt-review.googlesource.com/4050
   - Some of Elemental JSON is broken in dev 
   mode: https://code.google.com/p/google-web-toolkit/issues/detail?id=7484 
   (partly fixed by above review)

Once that's fixed, you could then use: payload = ((JsJsonValue) 
jsonDataFromJSNI).toJson(); (note: uses JSON.stringify under-the-hood)

The next step will be to "port" AutoBean to use elemental.json instead of 
org.json and add an overload to AutoBeanCodex.decode that takes a JsonValue.

(side note: the data you get from the page is JS, not JSON; JSON is a 
serialization format, if you have objects, then it's JS, possibly expressed 
as JS literals; this is one reason why JSON-P is completely misnamed: 
there's no JSON in JSON-P, at all)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: JSON Parsing in GWT Client

2012-05-25 Thread Jens

>
> "restygwt drives one of the biggest websites in Germany. We never had 
> any performance issues."
>
> You can't say which one, i suggest? :) Would be interesting to know.


Just a guess: probably studivz.net / meinvz.net. Its a german social 
network and has been rewritten in GWT some time ago. But you have to sign 
up and log in to switch to the new GWT version and see it in action. They 
use Rest like requests and they have forked restygwt on github 
(https://github.com/vznet).

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/hLMv17IsStEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-25 Thread Alex opn
"restygwt drives one of the biggest websites in Germany. We never had 
any performance issues."

You can't say which one, i suggest? :) Would be interesting to know.

Am Freitag, 25. Mai 2012 13:03:58 UTC+2 schrieb ra:
>
> Hi, 
>
>
> the solution is really simple: 
> Use resty gwt: https://github.com/chirino/resty-gwt 
>
> A sample project including GWT configuration can be found here: 
> http://code.google.com/p/play-gae-gwt-dreamteam-showcase 
>
> restygwt drives one of the biggest websites in Germany. We never had 
> any performance issues. 
>
>
> Cheers, 
>
> Raphael 
>
> On Thu, May 24, 2012 at 10:52 AM, Thomas Broyer  
> wrote: 
> > 
> > 
> > On Thursday, May 24, 2012 8:56:53 AM UTC+2, dominikz wrote: 
> >> 
> >> I was just having the same problem. I evaluated the solutions yesterday 
> >> and frankly speaking was surprised by the lack of straight answers from 
> both 
> >> GWT documentation and the internet. 
> >> The number of projects there are is just amazing, but nothing seems to 
> >> stand out. 
> >> 
> >> I don't like the idea of using Overlay Types since it's too much coding 
> >> and the objects coded this way can be used only on browser-side 
> >> I'm not sure what's the status of AutoBean 
> >> (http://code.google.com/p/google-web-toolkit/wiki/AutoBean) since 
> clicking 
> >> on 'Project Home' here takes me to some I think very old start page for 
> GWT. 
> >> No official references from main GWT 
> >> site https://developers.google.com/web-toolkit/ 
> > 
> > AutoBean is the technology backing RequestFactory; it's stable and has 
> very 
> > few known bugs in 2.4 (one or two, no more; all being already fixed in 
> > trunk; this is an all different story for RequestFactory). 
> > I just think nobody had/took the time to copy the wiki page to the dev 
> guide 
> > at developers.google.com/web-toolkit. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Google Web Toolkit" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/google-web-toolkit/-/I6JfHi2Gw4QJ. 
> > 
> > To post to this group, send email to google-web-toolkit@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > google-web-toolkit+unsubscr...@googlegroups.com. 
> > For more options, visit this group at 
> > http://groups.google.com/group/google-web-toolkit?hl=en. 
>
>
>
> -- 
> inc: http://ars-machina.raphaelbauer.com 
> tech: http://ars-codia.raphaelbauer.com 
> web: http://raphaelbauer.com 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/YEMebkQic2gJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-25 Thread Raphael André Bauer
Hi,


the solution is really simple:
Use resty gwt: https://github.com/chirino/resty-gwt

A sample project including GWT configuration can be found here:
http://code.google.com/p/play-gae-gwt-dreamteam-showcase

restygwt drives one of the biggest websites in Germany. We never had
any performance issues.


Cheers,

Raphael

On Thu, May 24, 2012 at 10:52 AM, Thomas Broyer  wrote:
>
>
> On Thursday, May 24, 2012 8:56:53 AM UTC+2, dominikz wrote:
>>
>> I was just having the same problem. I evaluated the solutions yesterday
>> and frankly speaking was surprised by the lack of straight answers from both
>> GWT documentation and the internet.
>> The number of projects there are is just amazing, but nothing seems to
>> stand out.
>>
>> I don't like the idea of using Overlay Types since it's too much coding
>> and the objects coded this way can be used only on browser-side
>> I'm not sure what's the status of AutoBean
>> (http://code.google.com/p/google-web-toolkit/wiki/AutoBean) since clicking
>> on 'Project Home' here takes me to some I think very old start page for GWT.
>> No official references from main GWT
>> site https://developers.google.com/web-toolkit/
>
> AutoBean is the technology backing RequestFactory; it's stable and has very
> few known bugs in 2.4 (one or two, no more; all being already fixed in
> trunk; this is an all different story for RequestFactory).
> I just think nobody had/took the time to copy the wiki page to the dev guide
> at developers.google.com/web-toolkit.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/I6JfHi2Gw4QJ.
>
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.



-- 
inc: http://ars-machina.raphaelbauer.com
tech: http://ars-codia.raphaelbauer.com
web: http://raphaelbauer.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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-25 Thread Harald Pehl
The actual parsing is done using GWT JSON API: 
JSONParser.parseStrict(String). I guess AutoBean does nothing different 
regarding parsing. I think the time conssuming parts in Piriti are related 
to resolving relations between objects and handling IDs and IDREFs. 
Although there are no real ID and IDREFs in JSON the code is pretty much 
the same for JSON and XML. This part could certainly be optimized. 

I will try to further analyze the hot spots in one of the next releases.

- Harald

Am Freitag, 25. Mai 2012 09:07:09 UTC+2 schrieb dominikz:
>
> Looking at the data it seems that piriti JSON parsing is as slow as piriti 
> XML parsing. Generally XML dom parsing (without using piriti) is way slower 
> than any JSON. 
>
> Maybe this is a clue?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/DNecmjl-bMAJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-25 Thread dominikz
Looking at the data it seems that piriti JSON parsing is as slow as piriti 
XML parsing. Generally XML dom parsing (without using piriti) is way slower 
than any JSON. 

Maybe this is a clue?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/864JSFz_HAwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-24 Thread dominikz

>
> Nevertheless I'm happy to see that Piriti is actively used. If you have 
> any questions don't hesitate to ask.
>
>>
>>
Actually I have. Do you know why AutoBeans is much faster? 
Can you share some details? You know your implementation better then all of 
us.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ILSS7gdEZYEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-24 Thread dominikz
Don't get me wrong. One of my developers was evaluating JSON frameworks. He 
really liked pirity due to the fact that you can annotate fields there and 
not setters and getters like in AutoBean. He fealt that it's just too much 
code. I know this discussion is academic, but that's how he feels.

I'm also not sure whether you can plug in custom code formatters in 
AutoBeans as easily as in piriti.

So if it wasn't for performance we'd use piriti. Especially because it's so 
easy to switch to XML.

The reason why performance is so important for us is because our apps are 
on mobile. This parsing time can easily make the app seem unresponsive to 
the user. 

If we were writing for desktop browsers, we probably wouldn't care so much 
about each millisecond of parsing.

I guess what I wanted to say is that you've done a really good job with 
piriti. I know it's hard to fight with a group of hired google developers.


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/OHOX2x8ofFMJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-24 Thread Harald Pehl
Thanks for the numbers  It's quite interesting for me to see how Piriti 
performs compared to AutoBeans. In recent versions, I've added new features 
mainly (right now I'm working on JAXB support). Regarding performance 
there's still room for improvement. The problem is that Piriti is currently 
a one-man-show and my time is limited.

Nevertheless I'm happy to see that Piriti is actively used. If you have any 
questions don't hesitate to ask.

- Harald (author of Piriti)

Am Donnerstag, 24. Mai 2012 14:24:22 UTC+2 schrieb dominikz:
>
> Just got performance results for various browsers and devices.
> If you're interested please take a look here:
>
>
> https://docs.google.com/spreadsheet/ccc?key=0AsuvWfSBnfyodEZqdmktOGNacG1MX0tsM0FBdXhXdUE#gid=0
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/CmmEZHAV9nsJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-24 Thread dominikz
Just got performance results for various browsers and devices.
If you're interested please take a look here:

https://docs.google.com/spreadsheet/ccc?key=0AsuvWfSBnfyodEZqdmktOGNacG1MX0tsM0FBdXhXdUE#gid=0

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/b5NXJ0XKJTkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-24 Thread dominikz
Thanks Thomas,

we're now doing performance comparision between AutoBean and Piriti. 
We still don't know whether there will be problems with AutoBean on mobile 
devices - I guess not.

Do you know of any streghts/weaknesses of piriti/AutoBean?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/PL6vRNl-h8gJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-24 Thread Thomas Broyer


On Thursday, May 24, 2012 8:56:53 AM UTC+2, dominikz wrote:
>
> I was just having the same problem. I evaluated the solutions yesterday 
> and frankly speaking was surprised by the lack of straight answers from 
> both GWT documentation and the internet. 
> The number of projects there are is just amazing, but nothing seems to 
> stand out.
>
>
>- I don't like the idea of using Overlay Types since it's too much 
>coding and the objects coded this way can be used only on browser-side
>- I'm not sure what's the status of AutoBean (
>http://code.google.com/p/google-web-toolkit/wiki/AutoBean) since 
>clicking on 'Project Home' here takes me to some I think very old start 
>page for GWT. No official references from main GWT site 
>https://developers.google.com/web-toolkit/
>
> AutoBean is the technology backing RequestFactory; it's stable and has 
very few known bugs in 2.4 (one or two, no more; all being already fixed in 
trunk; this is an all different story for RequestFactory).
I just think nobody had/took the time to copy the wiki page to the dev 
guide at developers.google.com/web-toolkit.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/I6JfHi2Gw4QJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-24 Thread dominikz
And by the lack of straight answers I mean that.

Take a look at the number of projects listed in comments under the post:

http://stackoverflow.com/questions/683123/json-java-serialization-that-works-with-gwt

Surely, to evaluate all of them would take a week at least.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/kXrUDIaAqnAJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-23 Thread dominikz
I was just having the same problem. I evaluated the solutions yesterday and 
frankly speaking was surprised by the lack of straight answers from both 
GWT documentation and the internet. 
The number of projects there are is just amazing, but nothing seems to 
stand out.


   - I don't like the idea of using Overlay Types since it's too much 
   coding and the objects coded this way can be used only on browser-side
   - I'm not sure what's the status of AutoBean (
   http://code.google.com/p/google-web-toolkit/wiki/AutoBean) since 
   clicking on 'Project Home' here takes me to some I think very old start 
   page for GWT. No official references from main GWT site 
   https://developers.google.com/web-toolkit/

In the end I wanted to use Piriti. However, we've had problems with using 
it with XML parsing on Android. Our applications work mainly on phone 
browsers, so lack of support for XPath on some phone struck us really hard. 
However with JSON it's different. We were kind of resistant after having a 
bad experience with phones+piriti+XML, but it seems that phones+piriti+JSON 
work. We just checked it on Android (Native browser, Opera Mobile and Opera 
Mini) on Samsung's Bada and on iPhone (Native Browser) and the test passed 
OK.

So given that piriti's code looks really nice and it's easy to switch 
between JSON and XML (if we ever needed),we'll try to go with that.

One issue we still have not resolved is the performance. We started with 
XML in the payload, since our apps work on SAP (ABAP is the language there) 
and it's easy to do XML on the backend rather than JSON. However, parsing 
of XML in the browser was not possible with piriti on some mobile platforms 
(Android) and using DOM library was both time consuming to code and really 
slow. Parsing of our payload took 5-7 secs on Android. This was 
unacceptable. That's why the switch to JSON.

The thing we'll test right now is piriti+JSON performance. I'm not sure how 
piriti does the parsing, but it might be that other frameworks do it 
faster/slower.

*If anyone has an answer to the PERFORMANCE question of piriti+JSON, I'd be 
glad to hear.*

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/C0GWkTej1xIJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parsing in GWT Client

2012-05-23 Thread Ümit Seren
Both AutoBeanFactory as well as JSO are secure and suitable for parsing 
JSON. 
The good thing about AutoBeanFactory is that you can also use on the 
backend to encode objects as JSON. 
Did you check the official google docs on AutoBeans (
http://code.google.com/p/google-web-toolkit/wiki/AutoBean)? 
Another approach I have been using in my projects (GWTP) is Harald Pehl's 
piriti library (http://code.google.com/p/piriti/). 




On Monday, May 21, 2012 2:08:00 PM UTC+2, Santosh wrote:
>
> We have use GWT Platform with GWTP client and rest web services within 
> GUICE container. Rest service invocation from GWT client is done using 
> JSONPRequestbuilder. 
>
> I want to know which is the best JSON response string parsing 
> technique for GWT? - JSON to Java serialization/deserialization 
>
> After lot of search on google, I found out that we have these many 
> options. 
>
> a. GWT built in JSONParser parseStrict method which is called secured 
> and best way to go. But this may not be suitable for complex JSON 
> response string. Becuase you need to write lot of code to parse each 
> item in JSON response and convert to a Java object. 
> b. GWT AutobeanFactory approach - I dont know how best to use this? We 
> are using GWT 2.4, you do not have any complete example of using this 
> approach at all. Everywhere, people say its an approach but no where 
> we have detailed description on this. Few samples on google were from 
> gwt older versions which were changed a lot in GWT 2.4.  Please 
> somebody share a good example with GWT 2.4 and Autobean factory 
> approach for JSON ser/deser... 
> c. JavaScript overlay types: People say it is not the secured way to 
> go. So I am bit hesitate whether we should use this or not. 
>
> Moreover, we are migrating from GWT to SmartGWT very soon. I hope, the 
> rest call services with these should continue to work even in SmartGWT 
> without any changes. (Because SmartGWT also comes with a predefined 
> format JSON rest support which we may not use as we already have built 
> these services in general). 
>
> Kindly advice asap. 
>
> Thanks 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/TTEywqVq6FkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Data in GWT

2011-11-01 Thread Thomas Broyer
What do you mean by "a form in JSON format", and "render this JSON data" ?

BTW, besides other responses whose authors plug their own projects, GWT 
proper can do it too:

You can:

   1. define JavaScriptOverlay 
types
   2. parse JSON using 
JsonUtils.safeEval

Or you can:

   1. define AutoBean 
interfaces and 
   an AutoBeanFactory
   2. GWT.create() your AutoBeanFactory
   3. parse JSON using 
AutoBeanCodex.decode


As for the "rendering" part, well, if you're talking about "form data" 
(rather than form fields' description), have a look at the Editor 
framework, 
it'll work with either approach above.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/bFfFyj6tG4UJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Data in GWT

2011-10-31 Thread Fabricio Pizzichillo
HI
i recommend piriti, it's very simple to use. its a tool that can map json
to bean in client code
 http://code.google.com/p/piriti/

regards

Fabricio

2011/10/31 IDeshpande 

> Hi All,
>
> I have my application which sends me a form in JSON format.
> Is there any direct way or API GWT provides to render this JSON data
> into any GWT UI element like Panel or a Dialog box?
>
> --
> 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-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Data in GWT

2011-10-31 Thread Raphael André Bauer
On Mon, Oct 31, 2011 at 4:37 PM, IDeshpande  wrote:
> Hi All,
>
> I have my application which sends me a form in JSON format.
> Is there any direct way or API GWT provides to render this JSON data
> into any GWT UI element like Panel or a Dialog box?

GWT itself does not support direct JSON Widget data binding.
If you want to parse JSON data I can recommend
https://github.com/chirino/resty-gwt . Rendering data after parsing
with resty gwt is simple...

Best,

Raphael

>
> --
> 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-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>



-- 
inc: http://ars-machina.raphaelbauer.com
tech: http://ars-codia.raphaelbauer.com
web: http://raphaelbauer.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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON issue with GWT

2011-10-09 Thread Konstantin Zolotarev
JsArray modelsList = JsonUtils.safeEval(yourJsonString);

And then you cuold use 
JsArrayto
 get any model you need.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Q_DYk_lUnUwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON issue with GWT

2011-10-09 Thread anand jain
I have no idea..could you please tell me how to use it?

On Sun, Oct 9, 2011 at 8:21 PM, Patrick Tucker  wrote:

> Did you look at JsArray or JsArrayString?
>
> On Oct 8, 4:17 am, anand jain  wrote:
> > I am making a DTO (JSON fomat). In that if my method returns a List,
> > then I am unable to get that List elements from JS0N string. In JSON
> > string, I can see the elements but unable to fetch them.
> >
> > Can anybody help me?
>
> --
> 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-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON issue with GWT

2011-10-09 Thread Patrick Tucker
Did you look at JsArray or JsArrayString?

On Oct 8, 4:17 am, anand jain  wrote:
> I am making a DTO (JSON fomat). In that if my method returns a List,
> then I am unable to get that List elements from JS0N string. In JSON
> string, I can see the elements but unable to fetch them.
>
> Can anybody help me?

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON

2011-09-21 Thread Thomas Broyer
On the client-side: JsonUtils.safeEval for parsing, with JS overlay classes, 
and new JSONObject(jso).toString() for serialization (unfortunately not that 
great for performance, as it creates bunch of temporary objects: one for 
each value in your objects) work well.

For better performance on the client-side, and/or if you also want 
server-side support, have a look at AutoBeans. Use GWT.create() on an 
AutoBeanFactory on the client-side, and an AutoBeanSource on the 
server-side, and the everything else can be shared between client-side and 
server-side.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/rZdibaKI9WUJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON

2011-09-20 Thread karim duran
Hi Facundo,

Did you try Google Gson :

http://code.google.com/p/google-gson/

Have a look, maybe it can help you.

Regards.

Karim Duran

2011/9/20 Facundo Schwindt 

> Hi Everyone.
>
> Anyone knows which are the best option for JSON Serialization and
> Deserialization ?
> Is only for JSON purpose !!
>
> I was looking Piriti and RestyGWT..
>
> I see that Piriti (http://code.google.com/p/piriti/wiki/GettingStarted)
> use aproximate 20 .jar  ( GIN 1.5 , 
> Guice
> 3.0  , Totoe 
> 0.2.4
>  )
>
> RestyGWT seem to be similar to Piriti but i did not test it yet
>
>
> Thanks
> Facundo
>
> --
> 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-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json serialization

2011-09-19 Thread Harald Pehl
You have different options for loading / parsing JSON data: 

   1. Receive it as a string from the server as a result of a RCP / REST 
   call. Therefore Pirit was originally intended.
   2. Load it from an external file. I'm using this option in my unit tests. 
   See 
   
http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideClientBundle.html#TextResource
 for 
   more details.

In any case the JsonReader interface needs the JSON data as string or as 
JSONObject. See 
http://piriti.googlecode.com/svn/site/apidocs/name/pehl/piriti/json/client/JsonReader.html
. 

BTW Piriti has its own group: https://groups.google.com/forum/#!forum/piriti. 
You can also ask questions there.

- Harald

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/RlEuPESrDFwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json parser

2011-06-20 Thread Thad
[{"string":"s","boolean":true}]  is a JSONArray, a subclass of
JSONValue.

{"item":[{"string":"s","boolean":"true"}]} is a JSONObject, also a
subclass of JSONValue.

See the diagrams at http://www.json.org/ and the GWT Javadoc for
com.google.gwt.json.client

On Jun 18, 11:55 am, Mark  wrote:
> When the JSON format is in the following form the
> JSONParser.parseStrict().isObject() works fine.
>
> {"item":[{"string":"s","boolean":"true"}]}
>
> When in the following format JSONParser.parseStrict().isObject() just
> returns null.
>
> [{"string":"s","boolean":true}]
>
> Does any know what causes this?  We are using the natural json form
> defined in jersey.
>
> Thanks

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Illegal token error

2011-06-07 Thread Kathiravan Tamilvanan
The problem is occuring due to the pojo field extendDir which is a "char". 
And the value in the json array is "extendDir":R. Isnt this supposed to be a 
single character string like "extendDir":"R". Is this a Bug?
Any ideas? 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ZDNHQWtleHp1QTBK.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json post not working

2011-05-13 Thread julio
Sorry forget it, it works properly, was a XSS problem
Julio

On May 13, 11:57 am, julio  wrote:
> Hi
>
> I have a json POST like this:
>
> { "first": 10 , "second" : 50 }
>
> with "content-type:application/json"
>
> With an external client the server replies correctly, but using:
>
> RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
>                 rb.setHeader("content-type", "application/json");
>                 try
>                 {
>                     rb.sendRequest("{ \"first\": 10 , \"second\" : 50 }", new
> RequestCallback() {
>                         public void onResponseReceived(Request request, 
> Response
> response) {}
>
>                         public void onError(Request request, Throwable 
> exception) {}
>                     });
>                 }
>                 catch (RequestException e) { Window.alert(e.toString()); }
>
> look like the server even hasn't get the request.
>
> How can I fix it?
>
> Thanks,
> Julio

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-18 Thread pete
I just used Guice + Gin + Mockito and found this very productive for
writing well tested code. Especially if you apply MVP on the client-
side, you can unit test your client logic rapidly / test-drive with
normal JUnit / TestNG.
I used RPC and just mocked out the AsyncCalls using Mockito,
simulating that certain Callbacks arrive.
Then you can just test your client side, make different scenarios,
suppose Object Blah is returned by AsyncCallback.onSuccess(Object obj)
and so on.
On the server side you can use Guice to decouple the actual
servicesImpl completely from the RPC-mechanism. Then your server
classes only need to implement the synchronous client interface, not
RemoteServiceServlet anymore.
So you can easily test all your server-side logic like normal java
classes, can check that if the client sends this and that RPC request
(meaning this and that request objects), that the service method
really does what it is supposed to, and gives back the correct values.

If you're interested in this, here are some links:

Guice:
http://code.google.com/docreader/#p=google-guice&s=google-guice&t=UsersGuide

Gin:
http://code.google.com/p/google-gin/

Mockito:
http://mockito.org/

How to mock AsyncCalls with Mockito (Example):
http://blog.reflectedcircle.co.uk/?p=162

How to use Guice for decoupling RPC-Services (Example):
http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/

If you use this, you can make sure, that the correct RPC-objects are
returned on simulated calls without ever sending real requests over
the wire or to specific URLs...


On Jan 18, 3:51 pm, Andy_W  wrote:
> Ok Thanks for all your replies, but this has confused me even more. I
> don't really want to introduce even more new technologies to learn
> over and above GWT and JSON. Can you test serverside code using GWT-
> RPC just by hitting a url like you can when using JSON?
>
> On Jan 17, 5:34 pm, Andy_W  wrote:
>
> > Hi,
>
> > I am trying to decide whether to use GWT-RPC or JSON for a new
> > project. We are using a full Java stack (Spring, Hibernate etc), so
> > most people would say it's a no brainer to use RPC. However, one of
> > things I did like about JSON was being able to hit a URL, without
> > loading up the UI, and then verifying the simple JSON string that came
> > back. This saves time if the UI is very complex and takes a good while
> > to load up. Is there any way to do this with GWT-RPC, or does the UI
> > need to be loaded up for testing?
>
> > Finally, is it possible to make "client side" unit tests with JSON
> > that extend GWTTestCase, or is this for RPC only?
>
> > Many thanks for any input.
>
>

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-18 Thread Thomas Broyer


On Tuesday, January 18, 2011 3:51:36 PM UTC+1, Andy_W wrote:
>
> Ok Thanks for all your replies, but this has confused me even more. I 
> don't really want to introduce even more new technologies to learn 
> over and above GWT and JSON. Can you test serverside code using GWT- 
> RPC just by hitting a url like you can when using JSON?


Short answer: no.

Long answer: it shouldn't matter, because what you want is that the service 
behaves as expected. It doesn't matter how the returned value is serialized 
because you don't control the serialization process. What I mean is that you 
should unit-test your service to check it's behavior, and if you want to do 
integration testing (does it still behave as expected once deployed and 
connected to the real database, etc.) then you can use things like 
http://code.google.com/p/gwt-syncproxy/ for GWT-RPC, or RequestFactoryMagic 
for RequestFactory.

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-18 Thread Andy_W
Ok Thanks for all your replies, but this has confused me even more. I
don't really want to introduce even more new technologies to learn
over and above GWT and JSON. Can you test serverside code using GWT-
RPC just by hitting a url like you can when using JSON?

On Jan 17, 5:34 pm, Andy_W  wrote:
> Hi,
>
> I am trying to decide whether to use GWT-RPC or JSON for a new
> project. We are using a full Java stack (Spring, Hibernate etc), so
> most people would say it's a no brainer to use RPC. However, one of
> things I did like about JSON was being able to hit a URL, without
> loading up the UI, and then verifying the simple JSON string that came
> back. This saves time if the UI is very complex and takes a good while
> to load up. Is there any way to do this with GWT-RPC, or does the UI
> need to be loaded up for testing?
>
> Finally, is it possible to make "client side" unit tests with JSON
> that extend GWTTestCase, or is this for RPC only?
>
> Many thanks for any input.

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-17 Thread Thomas Broyer
The RequestTransport is given the already-JSON-encoded payload as a String, 
so unless you parse it to re-serialize it as a "different JSON" (and doing 
the same on the server side in e.g. a servlet filter) I doubt it's possible.
The JSON payload is not "that" obfuscated though. It's entirely based on 
AutoBeans itself, and the messages are described 
at 
http://code.google.com/p/google-web-toolkit/source/browse/tags/2.1.1/user/src/com/google/gwt/requestfactory/shared/messages/
FYI (and IIUC), a "synthetic" ID is used for ValueProxy-s, while 
EntityProxy-s use either an "ephemeral" ID (when the object has been created 
on the client-side) or a "persisted" id (if it exists and is considered 
persisted on the server-side). ValueProxy-s use IDs so that the payload can 
use graphs of objects (AFAICT), where the same ValueProxy is used several 
times in the request. And every time you see a "Splittable", it's a 
JSON-encoded value as a String.
I'm pretty sure the format could change a bit in future releases though (I 
expect it to not change much though, to ease deployment of new versions of 
apps). Someone from Google could tell you.

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-17 Thread Jeff Larsen
Thomas, How hard would it be to change the RequestTransport to use a less 
obfuscated JSON, standard jackson JSON payload?

I'm curious because I am currently tasked with writing a framework that 
needs to be server agnostic. I'd gladly sacrifice some of the speed and 
transport efficiency for a pure JSON encoded object. I've poked around at 
the code a little bit, but it is easy to get lost in there. 


-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-17 Thread Ryan Mehregan
some useful resources on RequestFactory:

GWT Documentation:
http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html

excellent source of GWT related articles
http://tbroyer.posterous.com/

in-progress sample project
http://code.google.com/p/listwidget/

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-17 Thread Ryan Mehregan

If you decided to go with REST-like architecture,
exchanging JSON encoded data, there are some resources
that can either make the job easier for you, or be source of
inspiration.

make sure to also checkout AutoBean
http://code.google.com/p/google-web-toolkit/wiki/AutoBean

GWT-REST
http://code.google.com/p/gwt-gae-book/wiki/GWTREST

Resty-GWT:
http://restygwt.fusesource.org/

GWT-JSON-CommandPattern,
http://code.google.com/p/gwt-json-commandpattern/

Piriti
http://code.google.com/p/piriti/

interesting discussion on how to use REST with GWT can be found on
this thread:
http://groups.google.com/group/gwt-platform/browse_thread/thread/39bbc24842168f6a


Ryan

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-17 Thread Ryan Mehregan
RequestFactory comes with some helper classes that
allow you to run your tests within the JRE environment,
which means your tests are executed in miliseconds.

http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/requestfactory/server/testing/RequestFactoryMagic.java

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-17 Thread Ryan Mehregan
with GWT 2.1, there is another client-server communication mechanism
called RequestFactory.
RequestFactory uses JSON behind the scene, and aggressively caches
data,
when your data model changes, RequestFactory only sends the changed
bits over the wire, not the entire object graph;
Which results in improved performance.
RequestFactory also has a Service Layer which makes it easy to
integrate with thir-party frameworks including Spring.

RequestFactory is in charge of getting data to and from server,
once your data reaches the server, RequestFactory can hand the data
over to Spring,
so that Spring Service layer can take charge.
When You want to send data to the client, You hand in your data to
RequestFactory and RF sends it to the Client.


if you are starting a new project, I believe its worth looking into
RequestFactory.
RPC has been critisized for having a bit of overhead, in terms of
payload and a bit slow.
RequestFactory is where the GWT client-server communication is headed,
especially for data-oriented applications.



-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-17 Thread Thomas Broyer
Not to mention that you can do "in process" unit-testing with 
RequestFactory, which is very helpful! (this also means you can build a 
RequestFactory client in a few lines of pure-Java code, you'd just have to 
code and provide an appropriate RequestTransport to reach your servlet)

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON vs GWT-RPC - Unit testing and manual testing for a newbie

2011-01-17 Thread Y2i
For full Java stack RequestFactory may be another option for a new project.
http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-24 Thread Petr Arsentev
I changed code for server. I moved my servlet in app gwt. Now app gwt
use address http://127.0.0.1:/ and servlet 
http://127.0.0.1:/JSONServlet,
It is works.
But when I wanted used key -noserver, then I can't run app gwt with
this key.

On Dec 23, 9:41 pm, zixzigma  wrote:
> Petr,
> What did you do to make it work ?

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread zixzigma
Petr,
What did you do to make it work ?

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread Petr Arsentev
Thomas Broyer Thank very much ) It is works!

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread Thomas Broyer
Because gdata.youtube.com explicitly allows it using CORS: 
http://www.w3.org/TR/cors/ which most browser implement (all recent versions 
of any browser except IE)

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread Petr Arsentev
But when I use outsite resource String url = "http://gdata.youtube.com/
feeds/api/users/bogleg/uploads?alt=json-in-script&callback=1";
it is work correct.

On Dec 23, 6:22 pm, Thomas Broyer  wrote:
> This is likely the sign of an SOP issue (127.0.0.1: and localhost:8080
> are not the same origin: 127.0.01 != locahost, *and*  != 8080)
>
> (note that by url="/JSONServlet" I really meant replacing the value of the
> 'url' variable in your code)

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread Thomas Broyer
This is likely the sign of an SOP issue (127.0.0.1: and localhost:8080 
are not the same origin: 127.0.01 != locahost, *and*  != 8080)

(note that by url="/JSONServlet" I really meant replacing the value of the 
'url' variable in your code)

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread Petr Arsentev
Link  url="/JSONServlet" give just text "{'data':'test'}"
But I change code:
 @Override
public void onResponseReceived(Request request,
Response response) {
Window.alert(response.getStatusCode() + " "
+response.getStatusText() + " " + response.getText());
}
and now I have exception
ERROR: Uncaught exception escaped.
com.google.gwt.core.client.JavaScriptException:
(NS_ERROR_NOT_AVAILABLE): Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.statusText]
 QueryInterface: function QueryInterface() {
[native code]
}
 result: 2147746065
 filename: http://127.0.0.1:
 lineNumber: 98
 columnNumber: 0
 inner: null
 data: null
 initialize: function initialize() {
[native code]
}
What is problem?

On Dec 23, 5:36 pm, Thomas Broyer  wrote:
> On Wednesday, December 22, 2010 2:46:36 PM UTC+1, Petr Arsentev wrote:
>
> >             String url = "http://localhost:8080/JSONServlet";;
> >             RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,
> > url);
>
> Same Origin Policy ?
>
> What does url="/JSONServlet" give ?
>
> Just in case, 
> seehttp://code.google.com/webtoolkit/doc/latest/FAQ_Server.html#What_is_...
>  andhttp://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebu...

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread Thomas Broyer


On Wednesday, December 22, 2010 2:46:36 PM UTC+1, Petr Arsentev wrote:
>
>
> String url = "http://localhost:8080/JSONServlet";; 
> RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, 
> url);
>

Same Origin Policy ?

What does url="/JSONServlet" give ?

Just in case, see 
http://code.google.com/webtoolkit/doc/latest/FAQ_Server.html#What_is_the_Same_Origin_Policy,_and_how_does_it_affect_GWT?
 and 
http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT's

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread Petr Arsentev
Can you give example used Javascript Overlay?

On Dec 23, 6:49 am, Subhrajyoti Moitra  wrote:
> adding to the above.
>
> - Fix an UncaughtExceptioHandler to see if there are exceptions that are not
> being handled.
> - Use Gson to construct and deconstruct JSON in to POJO and vice versa. u
> can avoid the manual step in your servlet.
> - On the client use Javascript Overlay types to read the server response and
> process it.
> - Make sure your client and server are running on the same host, other wise
> u will need to use the cross-site compiler for client code and JSONP at the
> server to send responses back.
>
> HTH.
>
> Thanks,
> Subhro.
>
>
>
>
>
>
>
> On Thu, Dec 23, 2010 at 9:09 AM, zixzigma  wrote:
> > have you configured your servlet in web.xml file ?
>
> > --
> > 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-web-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com > cr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-23 Thread Petr Arsentev
Yes, I make configured for servlet
 
JSONServlet
com.trackstudio.JSONServlet


JSONServlet
/JSONServlet

When I set this link in browser I get json objects

On Dec 23, 6:39 am, zixzigma  wrote:
> have you configured your servlet in web.xml file ?

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-22 Thread zixzigma
Have a look at these two GWT-REST Frameworks,

RestyGWT
https://github.com/chirino/resty-gwt
http://restygwt.fusesource.org/documentation/index.html

GWT-JSON-CommandPattern
http://code.google.com/p/gwt-json-commandpattern/

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-22 Thread Subhrajyoti Moitra
adding to the above.

- Fix an UncaughtExceptioHandler to see if there are exceptions that are not
being handled.
- Use Gson to construct and deconstruct JSON in to POJO and vice versa. u
can avoid the manual step in your servlet.
- On the client use Javascript Overlay types to read the server response and
process it.
- Make sure your client and server are running on the same host, other wise
u will need to use the cross-site compiler for client code and JSONP at the
server to send responses back.

HTH.

Thanks,
Subhro.

On Thu, Dec 23, 2010 at 9:09 AM, zixzigma  wrote:

> have you configured your servlet in web.xml file ?
>
> --
> 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-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: json gwt

2010-12-22 Thread zixzigma
have you configured your servlet in web.xml file ?

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON+RequestBuilder vs RequestFactory

2010-11-17 Thread Thomas Broyer


On 17 nov, 08:59, zixzigma  wrote:
> Hello everyone.
>
> What are the benefits of using RequestFactory over JSON/Request
> Builder.
>
> to implement client-side communication/persistence i have to options:
>
> 1- using Spring/Spring MVC on the server to handle all the server-side
> work,
> and send JSON data to the GWT client.
>
> 2- i believe I still can use SpringMVC with RequestFactory, though not
> as cleanly seperated as the first approach.
>
> all the code will be in Java.
>
> What are the benefits of using RequestFactory over JSON/
> RequestBuilder ?

 - serialization/deserialization code is generated for you
 - partial objects (you ask for the properties you need using .with()
and only those goes to the wire)
 - AFAICT, the immutable object is shared across responses (and
updated as responses come back from the server)
 - events (dispatch on an EventBus) about objects having been
persisted/updated/deleted on the server (as side-effects of requests
from that one client –no broadcast– *and* the
RequestFactoryEditorDriver listens to them to automatically update the
display)
 - built-in JSR303 validation (after deserialization but before
invoking the "operation" on the server-side) sending back results as
Violations on the client-side (*and* you can ask the
RequestFactoryEditorDriver to display those violations, which is not
possible with the SimpleBeanEditorDriver, see issue 5567)

Of course, there are limitations too and, as always, some of the
benefits listed above come with drawbacks.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON requests with authorization and cross-site

2010-10-05 Thread lineman78
If it is basic auth then you should just be able to use JSONP, since
it is cross site, if form auth you will need to have them auth before
making the request.  Remember you can't make cross site requests
directly, but JSONP allows you to work around that.  Since it is an
authenticated request a server-side proxy is not really an option, so
you are pretty much stuck with JSONP.

On Oct 5, 2:18 pm, Wouter  wrote:
> Hi there,
> im quite new to GWT and i can not figure this one out...
> I want to do a JSON request to a server which would normally show me a
> popup to fill in my username and password. How can i access this with
> GWT? i tried the request builder and using setPassword and setUser but
> it doesnt work for me. The statuscode I receive after I make my
> request is '0' which i think is weird...
>
> can anybody help me out with this?

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Problem

2010-07-08 Thread hi...@hiramchirino.com
The easiest way by far is to use RestyGWT

http://restygwt.fusesource.org/documentation/index.html

With it, you just create GWT RPC style service interfaces to access
restful JSON resources.

For example, lets say you want to post some JSON to a URL of "/blog/
comments":

{
  "author":"Hiram",
  "website":"http://hiramchirino.com";,
  "comment":"This is my comment."
}

and you expect to get some JSON back that looks like:

{
  "comment-id":1234,
  "moderated":true
}

The you would create some DTO style classes to give you type safe
access to  the request and response like:

class CommentRequest {
  public String author;
  public String website;
  public String comment;
}

class CommentResponse {
  @Json(name="comment-id")
  public String commentId;
  public boolean moderated;
}

Notice that it can even deal with odd property names like "comment-id"
which would be very hard to access with js overlays.

Then you then create GWT RPC style service interfaces to access your
URL:

public interface CommentService extends RestService {
@POST @Path("/blog/comments")
public void comment(CommentRequest request,
MethodCallback callback);
}

You then create an instance use the service interface the same way
that
GWT RPC does it:

CommentService service = GWT.create(CommentService.class);

CommentRequest req = new CommentRequest
req.author = "Hiram"
req.website = "http://hiramchirino.com";
req.comment = "This is my comment."

service.comment(req, new MethodCallback() {
public void onFailure(Method method, Throwable exception) {
Window.alert("Error x: " + exception);
}

public void onSuccess(Method method, CommentResponse response) {
Window.alert("posted comment: "+response.commentId);
}
});

Hope that helped.


On Jul 5, 8:01 am, Ahmed Shoeib  wrote:
> Dear Friends ,
>
> i face a problem when trying to send and receive json object between
> client and server in GWT application
>
> so i want a simple example that show me how to do this
>
> Thanks,
> ahmed shoeib

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Problem

2010-07-07 Thread Ahmed Shoeib
i don't know how to get the parameter from RequestBuilder

i tried

rb.sendRequest("json_mem="+json_obj.toString(), new RequestCallback()
{

... }

and on ther server
req.getparameter(""json_mem") ;

and the result is null

how i can get the parameter in post method

On Jul 7, 11:08 pm, Thomas Broyer  wrote:
> On 7 juil, 20:47, Ahmed Shoeib  wrote:
>
>
>
> > hi ,
> > converting the java object to JSON Done using
>
> > SONObject json_obj = new JSONObject();
> > json_obj.put("Member_Email",new JSONString(symbol));
> > json_obj.put("Member_type", new JSONString(type));
>
> > and send it using post method using RequestBuilder
>
> > try {
> >                                 rb.sendRequest(json_obj.toString(), new 
> > RequestCallback() {
> > .
> > .
> > .
> > .
>
> > }
> > }
>
> > i need to know how to get this object on the server and convert it to
> > object again
>
> Using any JSON parser; seehttp://json.org/for a list of Java (or
> other language) implementations.
> Note that GWT 2.1 M1 and M2 include org.json, needed for the
> RequestFactory.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Problem

2010-07-07 Thread Thomas Broyer


On 7 juil, 20:47, Ahmed Shoeib  wrote:
> hi ,
> converting the java object to JSON Done using
>
> SONObject json_obj = new JSONObject();
> json_obj.put("Member_Email",new JSONString(symbol));
> json_obj.put("Member_type", new JSONString(type));
>
> and send it using post method using RequestBuilder
>
> try {
>                                 rb.sendRequest(json_obj.toString(), new 
> RequestCallback() {
> .
> .
> .
> .
>
> }
> }
>
> i need to know how to get this object on the server and convert it to
> object again

Using any JSON parser; see http://json.org/ for a list of Java (or
other language) implementations.
Note that GWT 2.1 M1 and M2 include org.json, needed for the
RequestFactory.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Problem

2010-07-07 Thread Ahmed Shoeib
hi ,
converting the java object to JSON Done using

SONObject json_obj = new JSONObject();
json_obj.put("Member_Email",new JSONString(symbol));
json_obj.put("Member_type", new JSONString(type));

and send it using post method using RequestBuilder

try {
rb.sendRequest(json_obj.toString(), new 
RequestCallback() {
.
.
.
.
}
}

i need to know how to get this object on the server and convert it to
object again

thanks ,
On Jul 6, 10:36 pm, eggsy84  wrote:
> Hi all,
>
> (As mentioned on the following 
> post:http://groups.google.com/group/google-web-toolkit/browse_thread/threa...
> )
>
> With the latest versions of GWT you don't have to use any other
> libraries.
>
> GWT now comes with something known as Javascript Overlays that you can
> utilise to convert JSON into Objects.
>
> See here:
>
> http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOver...
>
> Also I have made a bit of a discussion on my blog here:
>
> http://eggsylife.co.uk/2010/04/22/gwt-2-jsonp-and-javascript-overlays...
>
> Hope this helps,
>
> Eggsy
>
> On Jul 6, 1:44 pm, André Moraes  wrote:
>
> > I don't think that the Gson project can be used as a GWT module.
>
> > Looks like it is for pure java development, not GWT development.
>
> > Take a look at:http://code.google.com/p/piriti/
>
> > This project is a GWT library that provide
> > JSON and XML facilities.
>
> > On Tue, Jul 6, 2010 at 5:22 AM, Ahmed Shoeib
> > wrote:
>
> > > i face this problem
> > > how i can fix it
>
> > > the problem
>
> > > /AdminPanel.java'
> > >         [ERROR] Line 139: No source code is available for type
> > > com.google.gson.Gson; did you forget to inherit a required module?
>
> > > Thanks,
> > > ahmed shoeib
>
> > > On Jul 5, 9:33 pm, André Moraes  wrote:
> > > > The response comes async.
>
> > > > When the response from the server arrives at the client the method
> > > > onResponseReceived in the RequestCallback object is called, if an
> > > > error hapens the the onErrormethod is called.
>
> > > > The RequestCallback object is the second parameter in the sendRequest
> > > > function call.
>
> > > >                                 public void onResponseReceived(Request
> > > > request, Response response)
> > > > {
> > > >                                         if (response.getStatusCode()
> > > > == 200 || response.getStatusCode()
> > > > == 304)
> > > >                                         {
> > > >                                                 JavaScriptObject
> > > > responseData =
> > > > JsonHelper.stringToJso(response.getText()).cast());
> > > >             // use the response
> > > >                                         }
> > > >                                         else
> > > >                                         {
> > > >             // invalid response
> > > >                                         }
> > > >                                 }
> > > >                                 @Override
> > > >                                 public void onError(Request request,
> > > > Throwable exception) {
> > > >                                         // error on the resquest
> > > >                                 }
> > > >                         });
>
> > > > On 5 jul, 15:01, Ahmed Shoeib  wrote:
>
> > > > > you told me how to send request from client to server
>
> > > > > now i want how yo get data from server to use it in client
>
> > > > > and the data in json
>
> > > > > On Jul 5, 8:12 pm, André Moraes  wrote:
>
> > > > > > This code is quite simple
>
> > > > > > The line:
>
> > > > > >  re = rb.sendRequest("jsonrpc-call=" + JsonHelper.jsoToString(call),
> > > > > > new RequestCallback()
>
> > > > > > prepare a AJAX call to the server and make your javascript object to
> > > a
> > > > > > string using JsonHelper.jsoToString.
> > > > > > In ther server the json-string will be accessible by the parameter
> > > > > > "jsonrpc-call".
>
> > > > > > The line:
>
> > > > > >                                         if (response.getStatusCode()
> > > > > > == 200 || response.getStatusCode()
> > > > > > == 304)
> > > > > >                                         {
> > > > > >                                                 JavaScriptObject
> > > > > > responseData =
> > > > > > JsonHelper.stringToJso(response.getText()).cast());
> > > > > >             // use the response
> > > > > >                                         }
>
> > > > > > get the response wrote by the server and make i availabe as a
> > > > > > JavaScriptObject.
>
> > > > > > You can use the JSONObject class to populate and read a
> > > > > > JavaScriptObject.
>
> > > > > > You can read more about JSON + GWT at:
>
> > >http://code.google.com/intl/webtoolkit/webtoolkit/doc/latest/DevGuide...
> > > > > > andhttp://
> > > code.google.com/intl/webtoolkit/webtoolkit/articles/using_gwt_...
> > > > > > On 5 jul, 12:50, Ahmed Shoeib  wrote:
>
> > > > > > > i want a simple example to describe it
> > > > > > >

Re: JSON no cache data access

2010-07-06 Thread Jeroen Janssen
Hi,

I was wondering in your GWT code, do you cleanup the script after
processing the callback?

If you look at: 
http://code.google.com/intl/nl-NL/webtoolkit/doc/latest/tutorial/Xsite.html
there is some
documentation with regards to

"[5] Before the timeout function completes, it removes the new

Re: JSON Problem

2010-07-06 Thread eggsy84
Hi all,

(As mentioned on the following post:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/b7c280baf2375841#
)

With the latest versions of GWT you don't have to use any other
libraries.

GWT now comes with something known as Javascript Overlays that you can
utilise to convert JSON into Objects.

See here:

http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOverlay.html

Also I have made a bit of a discussion on my blog here:

http://eggsylife.co.uk/2010/04/22/gwt-2-jsonp-and-javascript-overlays-with-jsonprequestbuilder/

Hope this helps,

Eggsy

On Jul 6, 1:44 pm, André Moraes  wrote:
> I don't think that the Gson project can be used as a GWT module.
>
> Looks like it is for pure java development, not GWT development.
>
> Take a look at:http://code.google.com/p/piriti/
>
> This project is a GWT library that provide
> JSON and XML facilities.
>
> On Tue, Jul 6, 2010 at 5:22 AM, Ahmed Shoeib
> wrote:
>
>
>
> > i face this problem
> > how i can fix it
>
> > the problem
>
> > /AdminPanel.java'
> >         [ERROR] Line 139: No source code is available for type
> > com.google.gson.Gson; did you forget to inherit a required module?
>
> > Thanks,
> > ahmed shoeib
>
> > On Jul 5, 9:33 pm, André Moraes  wrote:
> > > The response comes async.
>
> > > When the response from the server arrives at the client the method
> > > onResponseReceived in the RequestCallback object is called, if an
> > > error hapens the the onErrormethod is called.
>
> > > The RequestCallback object is the second parameter in the sendRequest
> > > function call.
>
> > >                                 public void onResponseReceived(Request
> > > request, Response response)
> > > {
> > >                                         if (response.getStatusCode()
> > > == 200 || response.getStatusCode()
> > > == 304)
> > >                                         {
> > >                                                 JavaScriptObject
> > > responseData =
> > > JsonHelper.stringToJso(response.getText()).cast());
> > >             // use the response
> > >                                         }
> > >                                         else
> > >                                         {
> > >             // invalid response
> > >                                         }
> > >                                 }
> > >                                 @Override
> > >                                 public void onError(Request request,
> > > Throwable exception) {
> > >                                         // error on the resquest
> > >                                 }
> > >                         });
>
> > > On 5 jul, 15:01, Ahmed Shoeib  wrote:
>
> > > > you told me how to send request from client to server
>
> > > > now i want how yo get data from server to use it in client
>
> > > > and the data in json
>
> > > > On Jul 5, 8:12 pm, André Moraes  wrote:
>
> > > > > This code is quite simple
>
> > > > > The line:
>
> > > > >  re = rb.sendRequest("jsonrpc-call=" + JsonHelper.jsoToString(call),
> > > > > new RequestCallback()
>
> > > > > prepare a AJAX call to the server and make your javascript object to
> > a
> > > > > string using JsonHelper.jsoToString.
> > > > > In ther server the json-string will be accessible by the parameter
> > > > > "jsonrpc-call".
>
> > > > > The line:
>
> > > > >                                         if (response.getStatusCode()
> > > > > == 200 || response.getStatusCode()
> > > > > == 304)
> > > > >                                         {
> > > > >                                                 JavaScriptObject
> > > > > responseData =
> > > > > JsonHelper.stringToJso(response.getText()).cast());
> > > > >             // use the response
> > > > >                                         }
>
> > > > > get the response wrote by the server and make i availabe as a
> > > > > JavaScriptObject.
>
> > > > > You can use the JSONObject class to populate and read a
> > > > > JavaScriptObject.
>
> > > > > You can read more about JSON + GWT at:
>
> >http://code.google.com/intl/webtoolkit/webtoolkit/doc/latest/DevGuide...
> > > > > andhttp://
> > code.google.com/intl/webtoolkit/webtoolkit/articles/using_gwt_...
> > > > > On 5 jul, 12:50, Ahmed Shoeib  wrote:
>
> > > > > > i want a simple example to describe it
> > > > > > cause i need it as soon as possible
>
> > > > > > On Jul 5, 6:18 pm, André Moraes  wrote:
>
> > > > > > >                         re = rb.sendRequest("jsonrpc-call=" +
> > JsonHelper.jsoToString(call),
> > > > > > > new RequestCallback() {
>
> > > > > > >                                 @Override
> > > > > > >                                 public void
> > onResponseReceived(Request request, Response response)
> > > > > > > {
> > > > > > >                                         if
> > (response.getStatusCode() == 200 || response.getStatusCode()
> > > > > > > == 304)
> > > > > > >                                         {
> > > > > >

Re: JSON Problem

2010-07-06 Thread André Moraes
I don't think that the Gson project can be used as a GWT module.

Looks like it is for pure java development, not GWT development.

Take a look at: http://code.google.com/p/piriti/

This project is a GWT library that provide
JSON and XML facilities.

On Tue, Jul 6, 2010 at 5:22 AM, Ahmed Shoeib
wrote:

> i face this problem
> how i can fix it
>
> the problem
>
>
>
> /AdminPanel.java'
> [ERROR] Line 139: No source code is available for type
> com.google.gson.Gson; did you forget to inherit a required module?
>
>
> Thanks,
> ahmed shoeib
>
>
> On Jul 5, 9:33 pm, André Moraes  wrote:
> > The response comes async.
> >
> > When the response from the server arrives at the client the method
> > onResponseReceived in the RequestCallback object is called, if an
> > error hapens the the onErrormethod is called.
> >
> > The RequestCallback object is the second parameter in the sendRequest
> > function call.
> >
> > public void onResponseReceived(Request
> > request, Response response)
> > {
> > if (response.getStatusCode()
> > == 200 || response.getStatusCode()
> > == 304)
> > {
> > JavaScriptObject
> > responseData =
> > JsonHelper.stringToJso(response.getText()).cast());
> > // use the response
> > }
> > else
> > {
> > // invalid response
> > }
> > }
> > @Override
> > public void onError(Request request,
> > Throwable exception) {
> > // error on the resquest
> > }
> > });
> >
> > On 5 jul, 15:01, Ahmed Shoeib  wrote:
> >
> > > you told me how to send request from client to server
> >
> > > now i want how yo get data from server to use it in client
> >
> > > and the data in json
> >
> > > On Jul 5, 8:12 pm, André Moraes  wrote:
> >
> > > > This code is quite simple
> >
> > > > The line:
> >
> > > >  re = rb.sendRequest("jsonrpc-call=" + JsonHelper.jsoToString(call),
> > > > new RequestCallback()
> >
> > > > prepare a AJAX call to the server and make your javascript object to
> a
> > > > string using JsonHelper.jsoToString.
> > > > In ther server the json-string will be accessible by the parameter
> > > > "jsonrpc-call".
> >
> > > > The line:
> >
> > > > if (response.getStatusCode()
> > > > == 200 || response.getStatusCode()
> > > > == 304)
> > > > {
> > > > JavaScriptObject
> > > > responseData =
> > > > JsonHelper.stringToJso(response.getText()).cast());
> > > > // use the response
> > > > }
> >
> > > > get the response wrote by the server and make i availabe as a
> > > > JavaScriptObject.
> >
> > > > You can use the JSONObject class to populate and read a
> > > > JavaScriptObject.
> >
> > > > You can read more about JSON + GWT at:
> >
> > > >
> http://code.google.com/intl/webtoolkit/webtoolkit/doc/latest/DevGuide...
> > > > andhttp://
> code.google.com/intl/webtoolkit/webtoolkit/articles/using_gwt_...
> > > > On 5 jul, 12:50, Ahmed Shoeib  wrote:
> >
> > > > > i want a simple example to describe it
> > > > > cause i need it as soon as possible
> >
> > > > > On Jul 5, 6:18 pm, André Moraes  wrote:
> >
> > > > > > re = rb.sendRequest("jsonrpc-call=" +
> JsonHelper.jsoToString(call),
> > > > > > new RequestCallback() {
> >
> > > > > > @Override
> > > > > > public void
> onResponseReceived(Request request, Response response)
> > > > > > {
> > > > > > if
> (response.getStatusCode() == 200 || response.getStatusCode()
> > > > > > == 304)
> > > > > > {
> > > > > > JavaScriptObject
> responseData =
> > > > > > JsonHelper.stringToJso(response.getText()).cast());
> > > > > > // use the response
> > > > > > }
> > > > > > else
> > > > > > {
> > > > > > // invalid response
> > > > > > }
> > > > > > }
> >
> > > > > > @Override
> > > > > > public void onError(Request
> request, Throwable exception) {
> > > > > > // error on the resquest
> > > > > >

Re: JSON Problem

2010-07-06 Thread Ahmed Shoeib
i face this problem
how i can fix it

the problem



/AdminPanel.java'
 [ERROR] Line 139: No source code is available for type
com.google.gson.Gson; did you forget to inherit a required module?


Thanks,
ahmed shoeib


On Jul 5, 9:33 pm, André Moraes  wrote:
> The response comes async.
>
> When the response from the server arrives at the client the method
> onResponseReceived in the RequestCallback object is called, if an
> error hapens the the onErrormethod is called.
>
> The RequestCallback object is the second parameter in the sendRequest
> function call.
>
>                                 public void onResponseReceived(Request
> request, Response response)
> {
>                                         if (response.getStatusCode()
> == 200 || response.getStatusCode()
> == 304)
>                                         {
>                                                 JavaScriptObject
> responseData =
> JsonHelper.stringToJso(response.getText()).cast());
>             // use the response
>                                         }
>                                         else
>                                         {
>             // invalid response
>                                         }
>                                 }
>                                 @Override
>                                 public void onError(Request request,
> Throwable exception) {
>                                         // error on the resquest
>                                 }
>                         });
>
> On 5 jul, 15:01, Ahmed Shoeib  wrote:
>
> > you told me how to send request from client to server
>
> > now i want how yo get data from server to use it in client
>
> > and the data in json
>
> > On Jul 5, 8:12 pm, André Moraes  wrote:
>
> > > This code is quite simple
>
> > > The line:
>
> > >  re = rb.sendRequest("jsonrpc-call=" + JsonHelper.jsoToString(call),
> > > new RequestCallback()
>
> > > prepare a AJAX call to the server and make your javascript object to a
> > > string using JsonHelper.jsoToString.
> > > In ther server the json-string will be accessible by the parameter
> > > "jsonrpc-call".
>
> > > The line:
>
> > >                                         if (response.getStatusCode()
> > > == 200 || response.getStatusCode()
> > > == 304)
> > >                                         {
> > >                                                 JavaScriptObject
> > > responseData =
> > > JsonHelper.stringToJso(response.getText()).cast());
> > >             // use the response
> > >                                         }
>
> > > get the response wrote by the server and make i availabe as a
> > > JavaScriptObject.
>
> > > You can use the JSONObject class to populate and read a
> > > JavaScriptObject.
>
> > > You can read more about JSON + GWT at:
>
> > >http://code.google.com/intl/webtoolkit/webtoolkit/doc/latest/DevGuide...
> > > andhttp://code.google.com/intl/webtoolkit/webtoolkit/articles/using_gwt_...
> > > On 5 jul, 12:50, Ahmed Shoeib  wrote:
>
> > > > i want a simple example to describe it
> > > > cause i need it as soon as possible
>
> > > > On Jul 5, 6:18 pm, André Moraes  wrote:
>
> > > > >                         re = rb.sendRequest("jsonrpc-call=" + 
> > > > > JsonHelper.jsoToString(call),
> > > > > new RequestCallback() {
>
> > > > >                                 @Override
> > > > >                                 public void 
> > > > > onResponseReceived(Request request, Response response)
> > > > > {
> > > > >                                         if (response.getStatusCode() 
> > > > > == 200 || response.getStatusCode()
> > > > > == 304)
> > > > >                                         {
> > > > >                                                 JavaScriptObject 
> > > > > responseData =
> > > > > JsonHelper.stringToJso(response.getText()).cast());
> > > > >             // use the response
> > > > >                                         }
> > > > >                                         else
> > > > >                                         {
> > > > >             // invalid response
> > > > >                                         }
> > > > >                                 }
>
> > > > >                                 @Override
> > > > >                                 public void onError(Request request, 
> > > > > Throwable exception) {
> > > > >                                         // error on the resquest
> > > > >                                 }
> > > > >                         });
>
> > > > > public class JsonHelper {
>
> > > > >         public static String jsoToString(JavaScriptObject jso) {
> > > > >                 if (isJsonLibraryDefined()) {
> > > > >                         return _jsoToString(jso);
> > > > >                 } else {
> > > > >                         return new JSONObject(jso).toString();
> > > > >                 }
> > > > >         }
>
> > > > >         public static JavaScriptObject stringToJso(String value) {
> > > > >    

Re: JSON Problem

2010-07-05 Thread Ahmed Shoeib
Thanks a lot My Friends
it is easy way

thanks for your support

On Jul 5, 9:33 pm, André Moraes  wrote:
> The response comes async.
>
> When the response from the server arrives at the client the method
> onResponseReceived in the RequestCallback object is called, if an
> error hapens the the onErrormethod is called.
>
> The RequestCallback object is the second parameter in the sendRequest
> function call.
>
>                                 public void onResponseReceived(Request
> request, Response response)
> {
>                                         if (response.getStatusCode()
> == 200 || response.getStatusCode()
> == 304)
>                                         {
>                                                 JavaScriptObject
> responseData =
> JsonHelper.stringToJso(response.getText()).cast());
>             // use the response
>                                         }
>                                         else
>                                         {
>             // invalid response
>                                         }
>                                 }
>                                 @Override
>                                 public void onError(Request request,
> Throwable exception) {
>                                         // error on the resquest
>                                 }
>                         });
>
> On 5 jul, 15:01, Ahmed Shoeib  wrote:
>
> > you told me how to send request from client to server
>
> > now i want how yo get data from server to use it in client
>
> > and the data in json
>
> > On Jul 5, 8:12 pm, André Moraes  wrote:
>
> > > This code is quite simple
>
> > > The line:
>
> > >  re = rb.sendRequest("jsonrpc-call=" + JsonHelper.jsoToString(call),
> > > new RequestCallback()
>
> > > prepare a AJAX call to the server and make your javascript object to a
> > > string using JsonHelper.jsoToString.
> > > In ther server the json-string will be accessible by the parameter
> > > "jsonrpc-call".
>
> > > The line:
>
> > >                                         if (response.getStatusCode()
> > > == 200 || response.getStatusCode()
> > > == 304)
> > >                                         {
> > >                                                 JavaScriptObject
> > > responseData =
> > > JsonHelper.stringToJso(response.getText()).cast());
> > >             // use the response
> > >                                         }
>
> > > get the response wrote by the server and make i availabe as a
> > > JavaScriptObject.
>
> > > You can use the JSONObject class to populate and read a
> > > JavaScriptObject.
>
> > > You can read more about JSON + GWT at:
>
> > >http://code.google.com/intl/webtoolkit/webtoolkit/doc/latest/DevGuide...
> > > andhttp://code.google.com/intl/webtoolkit/webtoolkit/articles/using_gwt_...
> > > On 5 jul, 12:50, Ahmed Shoeib  wrote:
>
> > > > i want a simple example to describe it
> > > > cause i need it as soon as possible
>
> > > > On Jul 5, 6:18 pm, André Moraes  wrote:
>
> > > > >                         re = rb.sendRequest("jsonrpc-call=" + 
> > > > > JsonHelper.jsoToString(call),
> > > > > new RequestCallback() {
>
> > > > >                                 @Override
> > > > >                                 public void 
> > > > > onResponseReceived(Request request, Response response)
> > > > > {
> > > > >                                         if (response.getStatusCode() 
> > > > > == 200 || response.getStatusCode()
> > > > > == 304)
> > > > >                                         {
> > > > >                                                 JavaScriptObject 
> > > > > responseData =
> > > > > JsonHelper.stringToJso(response.getText()).cast());
> > > > >             // use the response
> > > > >                                         }
> > > > >                                         else
> > > > >                                         {
> > > > >             // invalid response
> > > > >                                         }
> > > > >                                 }
>
> > > > >                                 @Override
> > > > >                                 public void onError(Request request, 
> > > > > Throwable exception) {
> > > > >                                         // error on the resquest
> > > > >                                 }
> > > > >                         });
>
> > > > > public class JsonHelper {
>
> > > > >         public static String jsoToString(JavaScriptObject jso) {
> > > > >                 if (isJsonLibraryDefined()) {
> > > > >                         return _jsoToString(jso);
> > > > >                 } else {
> > > > >                         return new JSONObject(jso).toString();
> > > > >                 }
> > > > >         }
>
> > > > >         public static JavaScriptObject stringToJso(String value) {
> > > > >                 if (isJsonLibraryDefined()) {
> > > > >                         return _stringToJso(value);
> > > > >                 } else {
> > > > >             

Re: JSON Problem

2010-07-05 Thread André Moraes
The response comes async.

When the response from the server arrives at the client the method
onResponseReceived in the RequestCallback object is called, if an
error hapens the the onErrormethod is called.

The RequestCallback object is the second parameter in the sendRequest
function call.


public void onResponseReceived(Request
request, Response response)
{
if (response.getStatusCode()
== 200 || response.getStatusCode()
== 304)
{
JavaScriptObject
responseData =
JsonHelper.stringToJso(response.getText()).cast());
// use the response
}
else
{
// invalid response
}
}
@Override
public void onError(Request request,
Throwable exception) {
// error on the resquest
}
});


On 5 jul, 15:01, Ahmed Shoeib  wrote:
> you told me how to send request from client to server
>
> now i want how yo get data from server to use it in client
>
> and the data in json
>
> On Jul 5, 8:12 pm, André Moraes  wrote:
>
>
>
> > This code is quite simple
>
> > The line:
>
> >  re = rb.sendRequest("jsonrpc-call=" + JsonHelper.jsoToString(call),
> > new RequestCallback()
>
> > prepare a AJAX call to the server and make your javascript object to a
> > string using JsonHelper.jsoToString.
> > In ther server the json-string will be accessible by the parameter
> > "jsonrpc-call".
>
> > The line:
>
> >                                         if (response.getStatusCode()
> > == 200 || response.getStatusCode()
> > == 304)
> >                                         {
> >                                                 JavaScriptObject
> > responseData =
> > JsonHelper.stringToJso(response.getText()).cast());
> >             // use the response
> >                                         }
>
> > get the response wrote by the server and make i availabe as a
> > JavaScriptObject.
>
> > You can use the JSONObject class to populate and read a
> > JavaScriptObject.
>
> > You can read more about JSON + GWT at:
>
> >http://code.google.com/intl/webtoolkit/webtoolkit/doc/latest/DevGuide...
> > andhttp://code.google.com/intl/webtoolkit/webtoolkit/articles/using_gwt_...
> > On 5 jul, 12:50, Ahmed Shoeib  wrote:
>
> > > i want a simple example to describe it
> > > cause i need it as soon as possible
>
> > > On Jul 5, 6:18 pm, André Moraes  wrote:
>
> > > >                         re = rb.sendRequest("jsonrpc-call=" + 
> > > > JsonHelper.jsoToString(call),
> > > > new RequestCallback() {
>
> > > >                                 @Override
> > > >                                 public void onResponseReceived(Request 
> > > > request, Response response)
> > > > {
> > > >                                         if (response.getStatusCode() == 
> > > > 200 || response.getStatusCode()
> > > > == 304)
> > > >                                         {
> > > >                                                 JavaScriptObject 
> > > > responseData =
> > > > JsonHelper.stringToJso(response.getText()).cast());
> > > >             // use the response
> > > >                                         }
> > > >                                         else
> > > >                                         {
> > > >             // invalid response
> > > >                                         }
> > > >                                 }
>
> > > >                                 @Override
> > > >                                 public void onError(Request request, 
> > > > Throwable exception) {
> > > >                                         // error on the resquest
> > > >                                 }
> > > >                         });
>
> > > > public class JsonHelper {
>
> > > >         public static String jsoToString(JavaScriptObject jso) {
> > > >                 if (isJsonLibraryDefined()) {
> > > >                         return _jsoToString(jso);
> > > >                 } else {
> > > >                         return new JSONObject(jso).toString();
> > > >                 }
> > > >         }
>
> > > >         public static JavaScriptObject stringToJso(String value) {
> > > >                 if (isJsonLibraryDefined()) {
> > > >                         return _stringToJso(value);
> > > >                 } else {
> > > >                         return _stringToJsoEval(value);
> > > >                 }
> > > >         }
>
> > > >         public static native String _jsoToString(JavaScriptObject jso) 
> > > > /*-{
> > > >                 return JSON.stringify(jso);
> > > >         }-*/;
>
> > > >         public static native JavaScriptObjec

Re: JSON Problem

2010-07-05 Thread Ahmed Shoeib
you told me how to send request from client to server

now i want how yo get data from server to use it in client

and the data in json


On Jul 5, 8:12 pm, André Moraes  wrote:
> This code is quite simple
>
> The line:
>
>  re = rb.sendRequest("jsonrpc-call=" + JsonHelper.jsoToString(call),
> new RequestCallback()
>
> prepare a AJAX call to the server and make your javascript object to a
> string using JsonHelper.jsoToString.
> In ther server the json-string will be accessible by the parameter
> "jsonrpc-call".
>
> The line:
>
>                                         if (response.getStatusCode()
> == 200 || response.getStatusCode()
> == 304)
>                                         {
>                                                 JavaScriptObject
> responseData =
> JsonHelper.stringToJso(response.getText()).cast());
>             // use the response
>                                         }
>
> get the response wrote by the server and make i availabe as a
> JavaScriptObject.
>
> You can use the JSONObject class to populate and read a
> JavaScriptObject.
>
> You can read more about JSON + GWT at:
>
> http://code.google.com/intl/webtoolkit/webtoolkit/doc/latest/DevGuide...
> andhttp://code.google.com/intl/webtoolkit/webtoolkit/articles/using_gwt_...
> On 5 jul, 12:50, Ahmed Shoeib  wrote:
>
> > i want a simple example to describe it
> > cause i need it as soon as possible
>
> > On Jul 5, 6:18 pm, André Moraes  wrote:
>
> > >                         re = rb.sendRequest("jsonrpc-call=" + 
> > > JsonHelper.jsoToString(call),
> > > new RequestCallback() {
>
> > >                                 @Override
> > >                                 public void onResponseReceived(Request 
> > > request, Response response)
> > > {
> > >                                         if (response.getStatusCode() == 
> > > 200 || response.getStatusCode()
> > > == 304)
> > >                                         {
> > >                                                 JavaScriptObject 
> > > responseData =
> > > JsonHelper.stringToJso(response.getText()).cast());
> > >             // use the response
> > >                                         }
> > >                                         else
> > >                                         {
> > >             // invalid response
> > >                                         }
> > >                                 }
>
> > >                                 @Override
> > >                                 public void onError(Request request, 
> > > Throwable exception) {
> > >                                         // error on the resquest
> > >                                 }
> > >                         });
>
> > > public class JsonHelper {
>
> > >         public static String jsoToString(JavaScriptObject jso) {
> > >                 if (isJsonLibraryDefined()) {
> > >                         return _jsoToString(jso);
> > >                 } else {
> > >                         return new JSONObject(jso).toString();
> > >                 }
> > >         }
>
> > >         public static JavaScriptObject stringToJso(String value) {
> > >                 if (isJsonLibraryDefined()) {
> > >                         return _stringToJso(value);
> > >                 } else {
> > >                         return _stringToJsoEval(value);
> > >                 }
> > >         }
>
> > >         public static native String _jsoToString(JavaScriptObject jso) 
> > > /*-{
> > >                 return JSON.stringify(jso);
> > >         }-*/;
>
> > >         public static native JavaScriptObject _stringToJso(String string) 
> > > /*-
> > > {
> > >                 return JSON.parse(string);
> > >         }-*/;
>
> > >         public static native JavaScriptObject _stringToJsoEval(String
> > > string) /*-{
> > >                 return eval("(" + string + ")");
> > >         }-*/;
>
> > >         public static native boolean isJsonLibraryDefined() /*-{
> > >                 return typeof(JSON) != 'undefined'
> > >                         && typeof(JSON.parse) != 'undefined'
> > >                         && typeof(JSON.stringify) != 'undefined';
> > >         }-*/;
>
> > > }
>
> > > The JsonHelper class handle the conversion to and from JSON.
>
> > > If possible use the json.org javascript library that implements the
> > > functions JSON.parse / JSON.stringify
>
> > > I am currently writing a project that encapsulates that library and
> > > make it more easier to use than this JsonHelper class.
>
> > > When i release it in google-code I let you know.
>
> > > Hope it helps.
>
> > > On 5 jul, 09:01, Ahmed Shoeib  wrote:
>
> > > > Dear Friends ,
>
> > > > i face a problem when trying to send and receive json object between
> > > > client and server in GWT application
>
> > > > so i want a simple example that show me how to do this
>
> > > > Thanks,
> > > > ahmed shoeib

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this 

Re: JSON Problem

2010-07-05 Thread André Moraes
This code is quite simple

The line:

 re = rb.sendRequest("jsonrpc-call=" + JsonHelper.jsoToString(call),
new RequestCallback()

prepare a AJAX call to the server and make your javascript object to a
string using JsonHelper.jsoToString.
In ther server the json-string will be accessible by the parameter
"jsonrpc-call".


The line:

if (response.getStatusCode()
== 200 || response.getStatusCode()
== 304)
{
JavaScriptObject
responseData =
JsonHelper.stringToJso(response.getText()).cast());
// use the response
}

get the response wrote by the server and make i availabe as a
JavaScriptObject.

You can use the JSONObject class to populate and read a
JavaScriptObject.

You can read more about JSON + GWT at:

http://code.google.com/intl/webtoolkit/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideHttpRequests
and
http://code.google.com/intl/webtoolkit/webtoolkit/articles/using_gwt_for_json_mashups.html
On 5 jul, 12:50, Ahmed Shoeib  wrote:
> i want a simple example to describe it
> cause i need it as soon as possible
>
> On Jul 5, 6:18 pm, André Moraes  wrote:
>
>
>
> >                         re = rb.sendRequest("jsonrpc-call=" + 
> > JsonHelper.jsoToString(call),
> > new RequestCallback() {
>
> >                                 @Override
> >                                 public void onResponseReceived(Request 
> > request, Response response)
> > {
> >                                         if (response.getStatusCode() == 200 
> > || response.getStatusCode()
> > == 304)
> >                                         {
> >                                                 JavaScriptObject 
> > responseData =
> > JsonHelper.stringToJso(response.getText()).cast());
> >             // use the response
> >                                         }
> >                                         else
> >                                         {
> >             // invalid response
> >                                         }
> >                                 }
>
> >                                 @Override
> >                                 public void onError(Request request, 
> > Throwable exception) {
> >                                         // error on the resquest
> >                                 }
> >                         });
>
> > public class JsonHelper {
>
> >         public static String jsoToString(JavaScriptObject jso) {
> >                 if (isJsonLibraryDefined()) {
> >                         return _jsoToString(jso);
> >                 } else {
> >                         return new JSONObject(jso).toString();
> >                 }
> >         }
>
> >         public static JavaScriptObject stringToJso(String value) {
> >                 if (isJsonLibraryDefined()) {
> >                         return _stringToJso(value);
> >                 } else {
> >                         return _stringToJsoEval(value);
> >                 }
> >         }
>
> >         public static native String _jsoToString(JavaScriptObject jso) /*-{
> >                 return JSON.stringify(jso);
> >         }-*/;
>
> >         public static native JavaScriptObject _stringToJso(String string) 
> > /*-
> > {
> >                 return JSON.parse(string);
> >         }-*/;
>
> >         public static native JavaScriptObject _stringToJsoEval(String
> > string) /*-{
> >                 return eval("(" + string + ")");
> >         }-*/;
>
> >         public static native boolean isJsonLibraryDefined() /*-{
> >                 return typeof(JSON) != 'undefined'
> >                         && typeof(JSON.parse) != 'undefined'
> >                         && typeof(JSON.stringify) != 'undefined';
> >         }-*/;
>
> > }
>
> > The JsonHelper class handle the conversion to and from JSON.
>
> > If possible use the json.org javascript library that implements the
> > functions JSON.parse / JSON.stringify
>
> > I am currently writing a project that encapsulates that library and
> > make it more easier to use than this JsonHelper class.
>
> > When i release it in google-code I let you know.
>
> > Hope it helps.
>
> > On 5 jul, 09:01, Ahmed Shoeib  wrote:
>
> > > Dear Friends ,
>
> > > i face a problem when trying to send and receive json object between
> > > client and server in GWT application
>
> > > so i want a simple example that show me how to do this
>
> > > Thanks,
> > > ahmed shoeib

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Problem

2010-07-05 Thread Ahmed Shoeib
i want a simple example to describe it
cause i need it as soon as possible



On Jul 5, 6:18 pm, André Moraes  wrote:
>                         re = rb.sendRequest("jsonrpc-call=" + 
> JsonHelper.jsoToString(call),
> new RequestCallback() {
>
>                                 @Override
>                                 public void onResponseReceived(Request 
> request, Response response)
> {
>                                         if (response.getStatusCode() == 200 
> || response.getStatusCode()
> == 304)
>                                         {
>                                                 JavaScriptObject responseData 
> =
> JsonHelper.stringToJso(response.getText()).cast());
>             // use the response
>                                         }
>                                         else
>                                         {
>             // invalid response
>                                         }
>                                 }
>
>                                 @Override
>                                 public void onError(Request request, 
> Throwable exception) {
>                                         // error on the resquest
>                                 }
>                         });
>
> public class JsonHelper {
>
>         public static String jsoToString(JavaScriptObject jso) {
>                 if (isJsonLibraryDefined()) {
>                         return _jsoToString(jso);
>                 } else {
>                         return new JSONObject(jso).toString();
>                 }
>         }
>
>         public static JavaScriptObject stringToJso(String value) {
>                 if (isJsonLibraryDefined()) {
>                         return _stringToJso(value);
>                 } else {
>                         return _stringToJsoEval(value);
>                 }
>         }
>
>         public static native String _jsoToString(JavaScriptObject jso) /*-{
>                 return JSON.stringify(jso);
>         }-*/;
>
>         public static native JavaScriptObject _stringToJso(String string) /*-
> {
>                 return JSON.parse(string);
>         }-*/;
>
>         public static native JavaScriptObject _stringToJsoEval(String
> string) /*-{
>                 return eval("(" + string + ")");
>         }-*/;
>
>         public static native boolean isJsonLibraryDefined() /*-{
>                 return typeof(JSON) != 'undefined'
>                         && typeof(JSON.parse) != 'undefined'
>                         && typeof(JSON.stringify) != 'undefined';
>         }-*/;
>
> }
>
> The JsonHelper class handle the conversion to and from JSON.
>
> If possible use the json.org javascript library that implements the
> functions JSON.parse / JSON.stringify
>
> I am currently writing a project that encapsulates that library and
> make it more easier to use than this JsonHelper class.
>
> When i release it in google-code I let you know.
>
> Hope it helps.
>
> On 5 jul, 09:01, Ahmed Shoeib  wrote:
>
> > Dear Friends ,
>
> > i face a problem when trying to send and receive json object between
> > client and server in GWT application
>
> > so i want a simple example that show me how to do this
>
> > Thanks,
> > ahmed shoeib

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Problem

2010-07-05 Thread André Moraes
re = rb.sendRequest("jsonrpc-call=" + 
JsonHelper.jsoToString(call),
new RequestCallback() {

@Override
public void onResponseReceived(Request request, 
Response response)
{
if (response.getStatusCode() == 200 || 
response.getStatusCode()
== 304)
{
JavaScriptObject responseData =
JsonHelper.stringToJso(response.getText()).cast());
// use the response
}
else
{
// invalid response
}
}

@Override
public void onError(Request request, Throwable 
exception) {
// error on the resquest
}
});


public class JsonHelper {

public static String jsoToString(JavaScriptObject jso) {
if (isJsonLibraryDefined()) {
return _jsoToString(jso);
} else {
return new JSONObject(jso).toString();
}
}

public static JavaScriptObject stringToJso(String value) {
if (isJsonLibraryDefined()) {
return _stringToJso(value);
} else {
return _stringToJsoEval(value);
}
}

public static native String _jsoToString(JavaScriptObject jso) /*-{
return JSON.stringify(jso);
}-*/;

public static native JavaScriptObject _stringToJso(String string) /*-
{
return JSON.parse(string);
}-*/;

public static native JavaScriptObject _stringToJsoEval(String
string) /*-{
return eval("(" + string + ")");
}-*/;

public static native boolean isJsonLibraryDefined() /*-{
return typeof(JSON) != 'undefined'
&& typeof(JSON.parse) != 'undefined'
&& typeof(JSON.stringify) != 'undefined';
}-*/;
}


The JsonHelper class handle the conversion to and from JSON.

If possible use the json.org javascript library that implements the
functions JSON.parse / JSON.stringify

I am currently writing a project that encapsulates that library and
make it more easier to use than this JsonHelper class.

When i release it in google-code I let you know.

Hope it helps.

On 5 jul, 09:01, Ahmed Shoeib  wrote:
> Dear Friends ,
>
> i face a problem when trying to send and receive json object between
> client and server in GWT application
>
> so i want a simple example that show me how to do this
>
> Thanks,
> ahmed shoeib

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json cross-domain examle (JS error on IE 8.0 - Object doesn't support this action)

2010-04-28 Thread gkneller
You are getting an error because the line of code:

delete window[callback];

doesn't do what the author of that tutorial thinks it ought to do in
IE8 and throws an exception instead. I can't tell if that's because
there's a bug in IE8 or in the author's understanding of the delete
operator. Either way it's not safe to use the code in that example -
window[] will keep growing every time you do another JSON call on IE8.

As others have pointed out, JsonpRequestBuilder is probably a better
bet for you if you've upgraded to GWT 2.0.

On Apr 21, 2:42 am, nasionalem  wrote:
> Hello Eggsy84,
>
> I am still getting same JavaScript error.
> I didnt see any changes in the turorial, but I did all the steps again
> but I got same 
> error.http://code.google.com/webtoolkit/doc/latest/tutorial/Xsite.html#design
>
> --
> 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-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json cross-domain examle (JS error on IE 8.0 - Object doesn't support this action)

2010-04-22 Thread eggsy84
Hi there,

I have now made a blog post on using the JsonpRequestBuilder please
see:

http://eggsylife.co.uk/2010/04/22/gwt-2-jsonp-and-javascript-overlays-with-jsonprequestbuilder/

On Apr 21, 10:11 am, nasionalem  wrote:
> I am also looking JsonpRequestBuilder class which you send me.. :) I
> will let you know If I can do it.
> I am looking forward your reply
> Thanks all for your helping
>
> --
> 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-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json cross-domain examle (JS error on IE 8.0 - Object doesn't support this action)

2010-04-21 Thread nasionalem
I am also looking JsonpRequestBuilder class which you send me.. :) I
will let you know If I can do it.
I am looking forward your reply
Thanks all for your helping

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json cross-domain examle (JS error on IE 8.0 - Object doesn't support this action)

2010-04-21 Thread nasionalem
Hello Eggsy84,

I am still getting same JavaScript error.
I didnt see any changes in the turorial, but I did all the steps again
but I got same error.
http://code.google.com/webtoolkit/doc/latest/tutorial/Xsite.html#design

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json cross-domain examle (JS error on IE 8.0 - Object doesn't support this action)

2010-04-20 Thread eggsy84
Oh yeah, damn!

I shall get the blog post written up today around lunch time and post
the link back here.

In the mean time the objects it concerns are within the API:

http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/jsonp/client/JsonpRequestBuilder.html



On Apr 20, 10:04 am, nasionalem  wrote:
> Hi Eggsy84,
>
> The document which you add in your other post is same tutoriol which I
> work on.
> Actually I didnt understand exactly what you mean. Could you please
> tell me how can I fix this error. Because I didnt find it in the
> tutorial.
>
> When was this tutorial updated? Because I worked on it yesterday night
> and I am getting JavaScript error on IE 8.0 .
>
> Thanks
>
> --
> 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-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json cross-domain examle (JS error on IE 8.0 - Object doesn't support this action)

2010-04-20 Thread nasionalem
Hi Eggsy84,

The document which you add in your other post is same tutoriol which I
work on.
Actually I didnt understand exactly what you mean. Could you please
tell me how can I fix this error. Because I didnt find it in the
tutorial.

When was this tutorial updated? Because I worked on it yesterday night
and I am getting JavaScript error on IE 8.0 .

Thanks

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json cross-domain examle (JS error on IE 8.0 - Object doesn't support this action)

2010-04-20 Thread eggsy84
Hi there,

GWT 2.0 now has methods for encapsulating this and the page you
mention has been updated to include them

I have mentioned this on another post at:

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/a9374e15a5ec6046

I am also going to make a blog post on how to make Cross site request
with GWT 2.0



On Apr 19, 9:22 pm, nasionalem  wrote:
> Hello,
>
> I am working on cross-domain example 
> below;http://code.google.com/webtoolkit/doc/latest/tutorial/Xsite.html#design
>
> I did all the steps in the tutorial, actually It works fine on
> "firefox" and "chrome". It also works on "IE 8.0", but I am just
> getting JavaScript Error in "IE 8.0".
> "Object doesn't support this action
> hosted.html
> Code: 0
> URI:http://127.0.0.1:/stockwatcher/hosted.html?stockwatcher";
>
> I've uploaded print screen of the error as 
> well,http://php.unikhas.s42.eatj.com/gwt-json.gif
>
> Any Idea,
>
> Thanks
>
> --
> 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-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Json cross-domain examle (JS Error: Object doesn't support this action - hosted.html)

2010-04-19 Thread nasionalem
I relized that It works successfully on Firefox and Chrome, but I'm
getting this error on IE 8.0.

-- 
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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: JSON Parser v/s JSONUtils - and safe parsing (and a bit of performance..)

2010-01-04 Thread Jeff Chimene
Thanks, Sri!

On 01/04/2010 03:02 PM, Sripathi Krishnan wrote:
> New subject -- we have diverged from the original post.
>  
> 
> Is JSONParser() also unsafe?
> 
> It also does an eval() without inspecting the string. So, yes, it is
> also unsafe.
> If you are unsure about the safety of your input string, then you should
> employ techniques before you invoke JSONUtils or JSONParser. See this
> discussion thread
> .

Good reference.
> From the JSONParser() code, I get the impression that it tries to
> differentiate among arrays, strings, &c. I thought that such
> behavior was A Good Thing.
> 
> Not as good as a Javascript overlay. When you get a rich,
> domain-specific object that is also performant, why would you want
> generics like an arrays and strings?

>From 30K ft., it looked like there was some validation of the JavaScript
object, in the sense that if I expect an array, then the isArray() test
fails at runtime.

Nevertheless, the gwt-rpc-plus looks interesting.

Sadly, since last time we spoke, my one chance to move to GWT from Perl
has evaporated. So, it's back to Perl until the wheel spins round and I
get another chance to move some of this one app's Perl code to GWT.

--

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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: JSON-P request for REST Services

2009-12-31 Thread Ric66
I have a GWT client communicating with a Sesame rdf store on a remote
server (using a REST protocol), so I need to bypass the same-origin
policy.

It works sending GET requests (size limited) with JSONP to a server
script that formats and redirects the requests to the Sesame server,
get the response and returns it to the client JSONed and enclosed in a
callback function.

I have tried restlet but I get a SOP exception:
org.restlet.gwt.resource.ResourceException: The URL http://... is
invalid or violates the same-origin security restriction
at org.restlet.gwt.resource.ClientResource.get(ClientResource.java:
351)

Thanks for any solution.

Ric

On Dec 29, 7:24 pm, Pablo Martin Gore  wrote:
>  we have been implementing our server layer with restlet(REST
> implementation).
> restlet has one implementation to use with GWT and is so easy , and  you can
> tell what method you want to use.http://www.restlet.org/
>
> 2009/12/29 jpnet 
>
>
>
> > You can't. JSONP is a hack to allow cross-domain requests. AFAIK, it
> > will only work for GET requests.
>
> > -JP
>
> > On Dec 28, 7:11 am, Fabio  wrote:
> > >http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=goog...
>
> > > This how-to is great but... what about POST-PUT-DELETE Restful
> > > requests?
> > > How can I change http method for 

Re: JSON-P request for REST Services

2009-12-29 Thread Pablo Martin Gore
 we have been implementing our server layer with restlet(REST
implementation).
restlet has one implementation to use with GWT and is so easy , and  you can
tell what method you want to use.
http://www.restlet.org/



2009/12/29 jpnet 

> You can't. JSONP is a hack to allow cross-domain requests. AFAIK, it
> will only work for GET requests.
>
> -JP
>
> On Dec 28, 7:11 am, Fabio  wrote:
> > http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=goog...
> >
> > This how-to is great but... what about POST-PUT-DELETE Restful
> > requests?
> > How can I change http method for 

Re: JSON-P request for REST Services

2009-12-29 Thread jpnet
You can't. JSONP is a hack to allow cross-domain requests. AFAIK, it
will only work for GET requests.

-JP

On Dec 28, 7:11 am, Fabio  wrote:
> http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=goog...
>
> This how-to is great but... what about POST-PUT-DELETE Restful
> requests?
> How can I change http method for 

Re: JSON - When to use JSONParser and when JavaScript object

2009-12-02 Thread Jeff Chimene
On Wed, Dec 2, 2009 at 4:48 PM, Thomas Broyer  wrote:

>
>
> On 2 déc, 23:52, Jeff Chimene  wrote:
> > Hi Thomas,
> >
> > I had stumbled upon this solution. However, you have an additional detail
> I
> > don't understand: The split between
> > interface MyModelObject
> > and
> > class MyModelObjectImpl extends JavaScriptObject implements MyModelObject
> >
> > What advantage does this gain? I think it has something to do w/. DI or
> > testing, but I cannot see why one wouldn't do
> > void get(AsyncCallback callback);
> >
> > i.e. don't use an interface, just do all templating via the class?
>
> If I'd do this, then I'd be breaking the assumption that my RPC
> interface could be implemented as a "real" GWT-RPC, because I'd be
> exposing an "implementation detail" (MyModelObjectImpl extends
> JavaScriptObject, which means it cannot be used on the server side, so
> this cannot be GWT-RPC but only an attempt at making something looking
> like GWT-RPC).
>
> The idea is that if I want to use GWT-RPC instead of my own
> implementation, it won't break the code using the service.
>

OK. I keep forgetting about Java RPC.


>
> > Also, I
> > see you're using @ImplementedBy. How does this differ from
> > bind(new TypeLiteral>()
> > {}).to(MockSessionReader.class);
>
> It's equivalent to bind(MyServiceAsync.class).to
> (MyServiceAsyncImpl.class) *except* that:
>  - because it's not explicit it's a "by default" binding  (aka "JIT
> binding"), which means that:
>   - it doesn't require a GIN module (my app is composed of several
> GWT modules, so I'd have my application-level GIN module –injector
> actually– to inherit the GIN modules of all inherited GWT module)
>   - it can be "overridden" by an explicit binding in a GIN module (we
> build "sample" apps to allow manual testing of the whole MVP –
> including the real view that'll be used in the app–, with sample
> service implementations that don't do any network call but instead
> return sample data that ideally cover all special cases that we could
> find "in the real" later; without the need to have the data in a
> database)
>  - it's easier to maintain than an explicit binding in a GIN
> module ;-)
>

OK, I think I get that line of reasoning. I've committed to two GIN modules.
However, I do like the JIT binding aspect.


>
> > There is a redundancy in the above that I haven't figured out how to
> factor
> > out. Ideally, it should be either
> > bind(new TypeLiteral>()
> {}).to(MockSessionReader.class);
> > or
> > bind(new TypeLiteral>()
> {}).to(MockSessionReader.class);
>
> I'm sorry, I don't understand: what are "reader" and "session" here?
> why is this using TypeLiteral?
>

The goal with TypeLiteral is to "color" an interface so that I can have one
interface describing all HTTP GET requests (ReaderTxn), and another
interface describing all HTTP PUT requests (WriterTxn). The "color" should
give GIN the information it needs to bind the implementation based on the
data type (aka "color")

bind(new TypeLiteral>() {}).to(MockSessionReader.class);
bind(new TypeLiteral>()
{}).to(MockAuthorizationReader.class);

I tried something like

public interface ReaderTxn {
   public get (String sessionId);

  public get (String username, String password);
}

But, as you know, the Session handler must implement the Authorization get()
and vice versa.

So now I just bury each of the above get() methods  in an implementation of
the data-type specific interface. An extension of the abstract Transaction
class handles the rest of the HTTP machinery:

public class AuthenticateReader extends Transaction implements
AuthenticateReaderTxn

This is probably clear as mud.

Anyway, I'm back to SessionReaderTxn and AuthorizationReaderTxn, i.e.
hard-coding the data type in the class name. The Type Literal is a holdover
from an earlier attempt to have a one routine handle multiple types.

>
> The @ImplementedBy is on the MyServiceAsync interface, not the
> AsyncCallback. The AsyncCallback is never injected by DI, I cannot see
> a use case for it (would you DI your event handlers?), it's generally
> implemented as an anonymous nested class, which also means it's
> explicitly instantiated where it's defined, i.e. in the presenters.
>

I see what you're doing (in the hazy sense of recognizing an image rippling
in a fun-house mirror).  I'll have to try this with one of the members of
the "model" package


> --
>
> 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-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>

--

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-web-tool...@googlegroups.com.
To unsubscribe from this gro

Re: JSON - When to use JSONParser and when JavaScript object

2009-12-02 Thread Thomas Broyer


On 2 déc, 23:52, Jeff Chimene  wrote:
> Hi Thomas,
>
> I had stumbled upon this solution. However, you have an additional detail I
> don't understand: The split between
> interface MyModelObject
> and
> class MyModelObjectImpl extends JavaScriptObject implements MyModelObject
>
> What advantage does this gain? I think it has something to do w/. DI or
> testing, but I cannot see why one wouldn't do
> void get(AsyncCallback callback);
>
> i.e. don't use an interface, just do all templating via the class?

If I'd do this, then I'd be breaking the assumption that my RPC
interface could be implemented as a "real" GWT-RPC, because I'd be
exposing an "implementation detail" (MyModelObjectImpl extends
JavaScriptObject, which means it cannot be used on the server side, so
this cannot be GWT-RPC but only an attempt at making something looking
like GWT-RPC).

The idea is that if I want to use GWT-RPC instead of my own
implementation, it won't break the code using the service.

> Also, I
> see you're using @ImplementedBy. How does this differ from
> bind(new TypeLiteral>()
> {}).to(MockSessionReader.class);

It's equivalent to bind(MyServiceAsync.class).to
(MyServiceAsyncImpl.class) *except* that:
 - because it's not explicit it's a "by default" binding  (aka "JIT
binding"), which means that:
   - it doesn't require a GIN module (my app is composed of several
GWT modules, so I'd have my application-level GIN module –injector
actually– to inherit the GIN modules of all inherited GWT module)
   - it can be "overridden" by an explicit binding in a GIN module (we
build "sample" apps to allow manual testing of the whole MVP –
including the real view that'll be used in the app–, with sample
service implementations that don't do any network call but instead
return sample data that ideally cover all special cases that we could
find "in the real" later; without the need to have the data in a
database)
 - it's easier to maintain than an explicit binding in a GIN
module ;-)

> There is a redundancy in the above that I haven't figured out how to factor
> out. Ideally, it should be either
> bind(new TypeLiteral>() {}).to(MockSessionReader.class);
> or
> bind(new TypeLiteral>() {}).to(MockSessionReader.class);

I'm sorry, I don't understand: what are "reader" and "session" here?
why is this using TypeLiteral?

The @ImplementedBy is on the MyServiceAsync interface, not the
AsyncCallback. The AsyncCallback is never injected by DI, I cannot see
a use case for it (would you DI your event handlers?), it's generally
implemented as an anonymous nested class, which also means it's
explicitly instantiated where it's defined, i.e. in the presenters.

--

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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: JSON - When to use JSONParser and when JavaScript object

2009-12-02 Thread Jeff Chimene
Hi Thomas,

I had stumbled upon this solution. However, you have an additional detail I
don't understand: The split between
interface MyModelObject
and
class MyModelObjectImpl extends JavaScriptObject implements MyModelObject

What advantage does this gain? I think it has something to do w/. DI or
testing, but I cannot see why one wouldn't do
void get(AsyncCallback callback);

i.e. don't use an interface, just do all templating via the class? Also, I
see you're using @ImplementedBy. How does this differ from
bind(new TypeLiteral>()
{}).to(MockSessionReader.class);

There is a redundancy in the above that I haven't figured out how to factor
out. Ideally, it should be either
bind(new TypeLiteral>() {}).to(MockSessionReader.class);
or
bind(new TypeLiteral>() {}).to(MockSessionReader.class);

Cheers,
jec

On Fri, Nov 27, 2009 at 2:30 PM, Thomas Broyer  wrote:

>
>
> On 27 nov, 16:56, Jeff Chimene  wrote:
> > On 11/12/2009 12:45 PM, Thomas Broyer wrote:
> >
> > > And actually, now that I've switched to GWT 2.0, I use interfaces to
> > > model my objects, with RemoteService/*Async interfaces to model my
> > > services; and I implement them using JSOs (JSOs can implement
> > > interfaces under certain conditions in GWT 2.0)
> >
> > Hi Thomas,
> >
> > Would you mind expanding on this a little bit? How does one implement a
> > JSO interface?
>
> interface MyModelObject {
>   String getFoo();
>   void setFoo(String foo);
> }
>
> class MyModelObjectImpl extends JavaScriptObject implements
> MyModelObject {
>   protected MyModelObjectImpl() { }
>   public final native String getFoo() /*-{ return this.foo; }-*/;
>   public final native void setFoo(String foo) /*-{ this.foo = foo; }-
> */;
> }
>
> There's really nothing special, but the interface cannot be
> implemented by more than one JSO.
>
> I then do:
> interface MyService extends RemoteService {
>   MyModelObject get();
> }
> @ImplementedBy(MyServiceAsyncImpl.class)
> interface MyServiceAsync {
>  void get(AsyncCallback callback);
> }
>
> implemented as:
> class MyServiceAsyncImpl implements MyServiceAsync {
>   public void get(AsyncCallback callback) {
>  // create a RequestBuilder, and in the
> RequestCallback::onResponceReceived, parse the response
> (JsonUtils.unsafeEval for instance) into a MyModelObjectImpl and pass
> it to the callback.onSuccess()
>   }
> }
>
> --
>
> 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-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>

--

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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: JSON - When to use JSONParser and when JavaScript object

2009-11-28 Thread Jeff Chimene
Thanks, very nice. I'll give it a try.

On Fri, Nov 27, 2009 at 2:30 PM, Thomas Broyer  wrote:

>
>
> On 27 nov, 16:56, Jeff Chimene  wrote:
> > On 11/12/2009 12:45 PM, Thomas Broyer wrote:
> >
> > > And actually, now that I've switched to GWT 2.0, I use interfaces to
> > > model my objects, with RemoteService/*Async interfaces to model my
> > > services; and I implement them using JSOs (JSOs can implement
> > > interfaces under certain conditions in GWT 2.0)
> >
> > Hi Thomas,
> >
> > Would you mind expanding on this a little bit? How does one implement a
> > JSO interface?
>
> interface MyModelObject {
>   String getFoo();
>   void setFoo(String foo);
> }
>
> class MyModelObjectImpl extends JavaScriptObject implements
> MyModelObject {
>   protected MyModelObjectImpl() { }
>   public final native String getFoo() /*-{ return this.foo; }-*/;
>   public final native void setFoo(String foo) /*-{ this.foo = foo; }-
> */;
> }
>
> There's really nothing special, but the interface cannot be
> implemented by more than one JSO.
>
> I then do:
> interface MyService extends RemoteService {
>   MyModelObject get();
> }
> @ImplementedBy(MyServiceAsyncImpl.class)
> interface MyServiceAsync {
>  void get(AsyncCallback callback);
> }
>
> implemented as:
> class MyServiceAsyncImpl implements MyServiceAsync {
>   public void get(AsyncCallback callback) {
>  // create a RequestBuilder, and in the
> RequestCallback::onResponceReceived, parse the response
> (JsonUtils.unsafeEval for instance) into a MyModelObjectImpl and pass
> it to the callback.onSuccess()
>}
> }
>
> --
>
> 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-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>

--

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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: JSON - When to use JSONParser and when JavaScript object

2009-11-27 Thread Thomas Broyer


On 27 nov, 16:56, Jeff Chimene  wrote:
> On 11/12/2009 12:45 PM, Thomas Broyer wrote:
>
> > And actually, now that I've switched to GWT 2.0, I use interfaces to
> > model my objects, with RemoteService/*Async interfaces to model my
> > services; and I implement them using JSOs (JSOs can implement
> > interfaces under certain conditions in GWT 2.0)
>
> Hi Thomas,
>
> Would you mind expanding on this a little bit? How does one implement a
> JSO interface?

interface MyModelObject {
   String getFoo();
   void setFoo(String foo);
}

class MyModelObjectImpl extends JavaScriptObject implements
MyModelObject {
   protected MyModelObjectImpl() { }
   public final native String getFoo() /*-{ return this.foo; }-*/;
   public final native void setFoo(String foo) /*-{ this.foo = foo; }-
*/;
}

There's really nothing special, but the interface cannot be
implemented by more than one JSO.

I then do:
interface MyService extends RemoteService {
   MyModelObject get();
}
@ImplementedBy(MyServiceAsyncImpl.class)
interface MyServiceAsync {
  void get(AsyncCallback callback);
}

implemented as:
class MyServiceAsyncImpl implements MyServiceAsync {
   public void get(AsyncCallback callback) {
  // create a RequestBuilder, and in the
RequestCallback::onResponceReceived, parse the response
(JsonUtils.unsafeEval for instance) into a MyModelObjectImpl and pass
it to the callback.onSuccess()
   }
}

--

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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: JSON - When to use JSONParser and when JavaScript object

2009-11-27 Thread Jeff Chimene
On 11/12/2009 12:45 PM, Thomas Broyer wrote:
>
> On 12 nov, 17:48, Raziel  wrote:
>> I know this depends on the details of what you're trying to achieve
>> and the JSON object to be parsed (for example if it's dynamic
>> orstatic, etc).
>>
>> I'm just wondering what are the principles that others follow to
>> determine when to use one or the other.
>
> I just do not ever use JSONParser, only JSOs (and with the JsonUtils
> in GWT 2.0 you don't even need to do the eval() yourself). I sometimes
> use the same JSO while the server sends me different JSON (with some
> properties missing in some cases and not in others), I just write my
> JSO to take this into account; for instance:
>
> public final native int getIntProp() /*-{
>return this.intProp !== null ? this.intProp : -1; // default
> value; use this.intProp || 0 if the default value coerce to false
> }-*/;
>
> And actually, now that I've switched to GWT 2.0, I use interfaces to
> model my objects, with RemoteService/*Async interfaces to model my
> services; and I implement them using JSOs (JSOs can implement
> interfaces under certain conditions in GWT 2.0)

Hi Thomas,

Would you mind expanding on this a little bit? How does one implement a 
JSO interface?

--

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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: JSON - When to use JSONParser and when JavaScript object

2009-11-12 Thread Thomas Broyer

On 12 nov, 17:48, Raziel  wrote:
> I know this depends on the details of what you're trying to achieve
> and the JSON object to be parsed (for example if it's dynamic
> orstatic, etc).
>
> I'm just wondering what are the principles that others follow to
> determine when to use one or the other.

I just do not ever use JSONParser, only JSOs (and with the JsonUtils
in GWT 2.0 you don't even need to do the eval() yourself). I sometimes
use the same JSO while the server sends me different JSON (with some
properties missing in some cases and not in others), I just write my
JSO to take this into account; for instance:

   public final native int getIntProp() /*-{
  return this.intProp !== null ? this.intProp : -1; // default
value; use this.intProp || 0 if the default value coerce to false
   }-*/;

And actually, now that I've switched to GWT 2.0, I use interfaces to
model my objects, with RemoteService/*Async interfaces to model my
services; and I implement them using JSOs (JSOs can implement
interfaces under certain conditions in GWT 2.0) and RequestBuilder
(everything's injected using GIN so other classes don't matter whether
they use real RPC or a RequestBuilder-based RESTful service request)

--

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-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=.




Re: JSON native function return value

2009-08-28 Thread Jason Essington

"id":"25" vs "id":25?

what is actually supplied in your JSON? the first is a string, the  
second a number

if you are getting the first, then your server side serializer is  
mucking things up for you.

-jason

On Aug 28, 2009, at 9:30 AM, jaimon wrote:

>
> hi all,
>
> i am using GWT and JSON.
> my question is regarding the native functions;
>
> i am receiving the JSON string OK my problem starts with the return
> value of the native functions,
> from some reason it can only be a String,
> something like:
> public final native String getId() /*-{ return this.id; }-*/;
>
> in if writing the native function like
> public final native int getId() /*-{ return this.id; }-*/;
>
> i am getting
> com.google.gwt.dev.shell.HostedModeException: Something other than an
> int was returned from JSNI method
> '@com.fishabook.ui.client.server.JsUserDetails::getRank()': JS value
> of type string, expected int
>
> event thought that on the data base the field is defined as INT.
>
> please advise
> >


--~--~-~--~~~---~--~~
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-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: JSON, HTTP POST and Django - json contaminated with newlines

2009-05-15 Thread Hannson

The issue was fixed by encoding the JSON with URL.encodeComponent().

I'm very thankful for your help!

On May 15, 10:12 pm, Thomas Broyer  wrote:
> On 15 mai, 22:14, Hannson  wrote:
>
> > I think I was wrong.
>
> > This problem does not happen unless the json string contains quotes
> > (escaped automatically by GWT like this: "this is a string that
> > contains \"quotes\"" ), even when URL.encoded. I'm not sure if this is
> > a GWT or Django issue.
>
> > Does anyone have any ideas?
>
> Have you tried URL.encodeComponent() on your JSON before sendRequest
> ("json=" + json, ...) ?
>
> I believe GWT is right on both JSON serialization and
> URL.encodeComponent() (this one is deferred to the browser);
> RequestBuilder is OK too (and let's hope your browser's XMLHttpRequest
> too).
> So I'd say that either your code is buggy, or PHP, or Django (PHP
> being buggy in many ways isn't a scoop). You should first have a look
> at the request's content that goes on the wire (use Firebug or a
> similar tool, or Fiddler or similar network "debugger"), and if it
> looks OK, then the problem is on the server side.
--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: JSON, HTTP POST and Django - json contaminated with newlines

2009-05-15 Thread Thomas Broyer



On 15 mai, 22:14, Hannson  wrote:
> I think I was wrong.
>
> This problem does not happen unless the json string contains quotes
> (escaped automatically by GWT like this: "this is a string that
> contains \"quotes\"" ), even when URL.encoded. I'm not sure if this is
> a GWT or Django issue.
>
> Does anyone have any ideas?

Have you tried URL.encodeComponent() on your JSON before sendRequest
("json=" + json, ...) ?

I believe GWT is right on both JSON serialization and
URL.encodeComponent() (this one is deferred to the browser);
RequestBuilder is OK too (and let's hope your browser's XMLHttpRequest
too).
So I'd say that either your code is buggy, or PHP, or Django (PHP
being buggy in many ways isn't a scoop). You should first have a look
at the request's content that goes on the wire (use Firebug or a
similar tool, or Fiddler or similar network "debugger"), and if it
looks OK, then the problem is on the server side.
--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: JSON, HTTP POST and Django - json contaminated with newlines

2009-05-15 Thread Hannson

I think I was wrong.

This problem does not happen unless the json string contains quotes
(escaped automatically by GWT like this: "this is a string that
contains \"quotes\"" ), even when URL.encoded. I'm not sure if this is
a GWT or Django issue.

Does anyone have any ideas?

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Json string parser displaying ""

2009-04-29 Thread rudolf michael
Hello there,In case you have JSONString then you can use .stringValue() and
for numbers you can use .getValue();
there is no need to do it manually.

regards,
ruds

On Wed, Apr 29, 2009 at 11:16 AM, newtoGWT  wrote:

>
>
> Please find my code below:
>
> Inside action class
> import net.sf.json.JSON;
> import net.sf.json.JSONSerializer;
> ...
> ...
> ValueBean value = new VallueBean();
> value.setPlainText("Search Result");
> JSON json = JSONSerializer.toJSON(writingsAssetValue);
> response.getWriter().write(json.toString());
>
> Inside GWT class
> public void onResponseReceived(Request request, Response
> response) {
>  if (200 == response.getStatusCode()) {
>  JSONValue jsonValue = JSONParser.parse(response.getText
> ());
>  searchButton.setEnabled(true);
>  Window.alert(jsonValue.toString());
>  Window.alert(jsonValue.isObject().get
> ("plainText").toString().replace("\"", ""));
>  flexTable.setHTML(row, 1, value.isObject().get
> ("plainText").toString());
>  } else {
>// Handle the error.  Can get the status text from
> response.getStatusText()
>  }
>}
>
> The problem here is Window.alert(jsonValue.toString()); displays
> "plainText":"Search Result"
>
> but i expected Window.alert(jsonValue.isObject().get
> ("plainText").toString()) to display
> Search Result (with out any double quotes) but it displayed as "Search
> Result"
>
> i  fixed this temp. by using replace method but i want to know whether
> this is the only way by which i can fix the double quote issue? or
> whether i am doing some thing wrong.
>
> Any help on this would be appreciated..
>
> Thanks!
> >
>

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: json date

2009-02-26 Thread Shawn Pearce
I wrote a parser to convert a JSON date string in UTC (e.g. right now its
'2009-02-26 18:38:03.0') into a java.sql.Timestamp so it can be
formatted in the user's own timezone.

The parser is here:

http://android.git.kernel.org/?p=tools/gwtjsonrpc.git;a=blob;f=src/main/java/com/google/gwtjsonrpc/client/JavaSqlTimestamp_JsonSerializer.java;hb=HEAD

Once its in a java.sql.Timestamp it can be formatted in the browser's
preferred timezone with the GWT DateTimeFormat class.


The downside to this approach is the dates from the server are all in UTC,
and the dates in the browser are in the browser's timezone.  If the date is
meant to record when someone performed some action, and that person is in
another timezone, it may be a loss of information.  Knowing that something
was written in my timezone at "6 pm" doesn't tell me that perhaps the author
is actually in Europe and it was actually more like 4 am for them.  At such
times, mistakes are much more likely (the author is probably not as alert)
and extra review might be needed.


On Thu, Feb 26, 2009 at 08:29, sssmack  wrote:

>
> The answer depends on whether you want the server to format the date
> or the client to.
> Send it as a JSONstring for the 1st case and as a JSONNumber for the
> latter.
> Send it as JSONNumber if you want the client (GWT) to be able to
> render the date as its local time.
>
> On Feb 25, 3:56 am, Lothar Kimmeringer  wrote:
> > Dimitrijević Ivan schrieb:
> >
> > > You can use sql99 standard (-MM-DD hh:mm:ss) to format date as
> > > string in php and write your parser which will convert sql99 date
> > > String into Date object in GWT.
> >
> > If the web-application is accessed internationally I think the
> > format used with iCalendar (AFAIR) or XML is better:
> > -MM-ddTHH:mm:ssZ
> > Otherwise there might be confusions what 03:00:00 means, the
> > timezone of the server or the timezone of the client. Or you
> > define that all times have to be in UTC and you convert them
> > accordingly on server- and client-side.
> >
> > Regards, Lothar
> >
>

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



  1   2   >