Hi again,
doesn't anybody have a solution / clue for me? Or is it even impossible to
have one instance of a Java class and use it the way instances are usually
used? Maybe I didn't make my point clear enough, so here's the code I used
for testing:
var button1 = new qx.ui.form.Button("setTestString", "rpctest/test.png");
var doc = this.getRoot();
doc.add(button1, {left: 100, top: 50});
var rpc = new qx.io.remote.Rpc("http://localhost:8080/rpctest/.qxrpc",
"rpc.RPCTest");
rpc.setCrossDomain(true);
var handler1 = function(result, exc) {
if (exc == null) {
alert("Result of handler1: " + result);
} else {
alert("Exception during handler1 async call: " + exc);
}
};
button1.addListener("execute", function(e) {
rpc.callAsync(handler1, "setTestString", "test it");
});
var button2 = new qx.ui.form.Button("getTestString", "rpctest/test.png");
doc.add(button2, {left: 100, top: 150});
var handler2 = function(result, exc) {
if (exc == null) {
alert("Result of handler2: " + result);
} else {
alert("Exception during handler2 async call: " + exc);
}
};
button2.addListener("execute", function(e) {
var str = rpc.callAsync(handler2, "getTestString");
});
And this is the Java class RPCTest:
public class RPCTest implements RemoteService {
int n;
String testString = "default";
public String getTestString() throws RemoteServiceException {
return testString;
}
public void setTestString(String s) throws RemoteServiceException {
testString = s;
}
}
Both methods work for themselves, but when I call setTestString() by
clicking button1 and then getTestString() by clicking button2 I get the
String "default" instead of "test it" because a new instance is created each
time. How can I manage to reuse the instance that has been created by
clicking button1?
marino99 wrote:
>
> Hello,
>
> I have a problem concerning RPC with Java. I use Apache Tomcat as a server
> on my local system. Async calls to Java classes work fine, but I would
> like to use one instance of a Java class again. I don't know if that's at
> all possible, but hope so.
> In more detail: I would like to be able to call the method setSomething()
> in the Java class and get the value I just set by calling getSomething().
> At the moment, a new instance is generated everytime I call any method.
> I think it's got something to do with Tomcat. Maybe I need to change any
> settings, e.g. web.xml?
>
> Thanks for your help!
>
--
View this message in context:
http://www.nabble.com/Java-RPC-and-instances-of-Java-classes-tp23447440p23524026.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel