Alexei Vinidiktov wrote:
> Hi Fabian,
>
> Thanks for your reply.
>
> The problem isn't manifesting any more. I haven't done anything for it
> to go away but I'm glad it has.
>
> On a related note, should each remote call use a separate
> qx.io.remote.Rpc variable, or can one be declared for the whole class
> and be reused?
>
> In the code that I posted in my first email I used a separate
> qx.io.remote.Rpc variable for each function (each listener has its own
> variable), but I've tried using just one such variable and it worked
> fine.
>
> I was wondering if reusing one variable for different remote calls
> could cause any conflicts and should be avoided.
>   

Request objects should only be used for a single request, so make sure 
to instantiate them fresh for each I/O request.

Thomas

> Thanks.
>
> On Tue, Apr 21, 2009 at 8:25 PM, Fabian Jakobs <[email protected]> wrote:
>   
>> Hi Alexei,
>>
>> I see nothing wrong with your code. I have no idea why you see this
>> behavior. Maybe it has something to do with your caching configuration.
>> Does it also happen if you completely disable caching in your browser?
>> Just a wild guess.
>>
>> Best Fabian
>>     
>>> Hi,
>>>
>>> I'm new to qooxdoo and web app development in general. I'm using
>>> qooxdoo 0.8.2 on Windows XP SP3 with Python 2.5.2.
>>>
>>> I'm trying to figure out how to use qooxdoo with the web2py Python
>>> based framework on the server side.
>>>
>>>  I'm using the native jsonrpc service provided by web2py. I've managed
>>> to make them work together but there's something I don't understand.
>>>
>>> I have a test qooxdoo application with 2 buttons and 2 labels. Each
>>> button has a listener that sends a JSON-RPC request to the web2py
>>> backend and receives a response.
>>>
>>> You can see it in action here:
>>> http://phonetizer.com/qooxdoo/
>>>
>>> Both listeners work fine - I can send a request and receive a response
>>> and then assign it to the corresponding label content.
>>>
>>> What I don't understand is why the second listener sometimes stops
>>> working after I rebuild the application, and to make it work I have to
>>> change variable names in it (say, var handler to var handler2, or var
>>> rpc to var rpc2). When it stops working clicking the corresponding
>>> button just makes it appear pressed for 5 to 10 seconds and then
>>> nothing happens.
>>>
>>> Here's the relevant source code:
>>>
>>> // Add button to document at fixed coordinates
>>>       doc.add(button1, {left: 100, top: 50});
>>>       doc.add(button2, {left: 100, top: 120});
>>>       doc.add(label1, {left: 100, top: 200});
>>>       doc.add(label2, {left: 100, top: 250});
>>>
>>>       // Add an event listener
>>>       button1.addListener("execute", function(e) {
>>>
>>>         var rpc = new qx.io.remote.Rpc(
>>>          "http://phonetizer.com/qooxdoo/default/call/jsonrpc";,
>>>          "");
>>>
>>>         // asynchronous call
>>>         var handler = function(result, exc) {
>>>         if (exc == null) {
>>>             label2.setContent(result);
>>>         } else {
>>>             alert("Exception during async call: " + exc);
>>>         }
>>>         };
>>>         rpc.callAsync(handler, "test");
>>>
>>>       });
>>>
>>>       button2.addListener("execute", function(e) {
>>>
>>>       var rpc = new qx.io.remote.Rpc(
>>>          "http://phonetizer.com/qooxdoo/default/call/jsonrpc";,
>>>          "");
>>>
>>>         // asynchronous call
>>>         var handler = function(result, exc) {
>>>         if (exc == null) {
>>>             label1.setContent(result[0][0]);
>>>         } else {
>>>             alert("Exception during async call: " + exc);
>>>         }
>>>         };
>>>         rpc.callAsync(handler, "getTasks");
>>>
>>>
>>>       });
>>>
>>>
>>>       
>>     
>
>
>
>   

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to