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
<script> element and the callback function from window."

Could it be that the your script is not removed from the browser yet
and as a result, will not reload correctly?

Best regards,

Jeroen Janssen

On 7 jul, 00:33, txciggy <[email protected]> wrote:
> Hi,
>
> In my GWT application, I am using JSON async callback mechanism
> (JSONP) to retrieve data from server side. Earlier I used cgi-bin perl
> scripts on server side to retrieve data and return http object back to
> the client (browser) via async callback function call. I figured that
> resource usage is much higher for cgi-bin scripts. Hence I moved away
> from cgi-bin scripts and instead resorted to passing data directly
> from a data file in web root's path through a HTTP get request. That
> is I am populating a data file located at WEB-ROOT/json/query_data
> periodically. This is being updated a separate polling process on the
> same server. This is read by client periodically to fetch JSON data.
> Instead of calling a cgi-bin script such as WEB-ROOT/cgi-bin/query.pl
> which does nothing but read query_data and package it into a HTTP
> header and passes it back through output stream back to client, I am
> attempting to directly read the JSON data file in my new
> implementation where the data file is pre-formatted to look like a
> callback function call.
>
> eg: INITIALLY
> ------------------
>
> WEB-ROOT/json/query_data:
>
> {..},...{..}
>
> which is just an array of JSON objects.
>
> WEB-ROOT/cgi-bin/query.pl :
>
> #!/usr/bin/perl
> use CGI;
> use Fcntl qw(:DEFAULT :flock);
>
> $q = CGI->new();
> print $q->header();
>
> # Read data from /tmp/json/query_data on an exclusive file lock
>         open($file, "< /tmp/json/query_data")
>                 or die "{\"type\":\"JSONError\"}\n";
>         flock($file, LOCK_SH)
>                 or die "{\"type\":\"FileLockError\"}\n";
>         @raw_data=<$file>;
>         close($file)
>                 or die "can't close file: $!";
>
> # Print JSON objects
> print "callback123([";
> foreach $line(@raw_data) {
>         print $line;}
>
> print "]);";
>
> When this script is called by client side code, JSON data from
> query_data is packaged into "callback123();" so that data is
> transferred over as a JSON object through a asynchronous callback
> mechanism. In my current implementation, I chose to bypass the above
> cgi-bin script  and instead, directly access the /tmp/json/query_data
> file by creating a symbolic link in WEB-ROOT so that client can access
> this file by just specifying URL "http://<IPADDR>/json/query_data".
>
> CURRENTLY:
> -------------------
>
> WEB-ROOT/json/query_data:
>
> callback123([{..},...{..}]);
>
> client calls - http://<IPADDR>/json/query_data and expects JSON object
> to be returned. This seems to work fine for the first request. However
> subsequent requests still fetch cached data from previous
> http://<IPADDR>/json/query_data access. I verified this by opening the
> above URL on browser. On repeated navigation to this URL, instead of
> getting updated data, I keep getting stale data from previous trial
> and only a page "refresh" seems to actually go and fetch updated info.
> How do I go around this?
>
> Thanks,
> Rajiv

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to