PDA

View Full Version : [2.x] jabsorb/JSON-RPC-Java Proxy for ExtJS



Arthur.Blake
22 Apr 2008, 2:22 PM
2008-04-30 UPDATE:
I've deleted the demo from the jabsorb web site and SVN repository due to ExtJS licensing issues. When I created the code, I was using ExtJS 2.0.2 which I had believed to be licensed under LGPL at the time. Since then, it has come to light that the LGPL licensing being used at that time was really an invalid license and ExtJS is now under a dual GPL/commercial license for ExtJS 2.1. Since jabsorb is under an Apache 2.0 license, the licenses are not compatible. Even though it's just demo code, I want to be absolutely sure I am following all licensing restrictions properly. I am going to create a separate project that is GPL licensed, just for the demo. I will update here again when that is up. Sorry for the confusion...

jabsorb (previously known as JSON-RPC-Java) is a lightweight Ajax/Web 2.0 Java/JavaScript framework that allows you to call methods in a Java web application as if they were local JavaScript methods in the browser. jabsorb handles the details of marshalling Java objects to and from JavaScript. See http://jabsorb.org for more info about jabsorb.

I wrote a JsonRpcProxy class to interface with jabsorb. It will also work fine with the older JSON-RPC-Java library. I am donating this class for use within ExtJS in the hopes that it will be added to ExtJS.

[original posting: http://extjs.com/forum/showthread.php?t=30759 -- thanks to mystix for pointing out that I had it posted in the wrong forum...]

jbeasley
23 Apr 2008, 5:39 AM
Looks great - thank you Arthur for your work on the demo.

I just recently saw this post, checked out jabsorb from your subversion repository, built it using ant (also ran 'ant test.dist' and 'ant install' according to the tutorial)... and build was successful.

When I run the application with Firebug, I do not get any errors, but do not see the grid either. Being a first-timer using Derby, can you tell me what might be the obvious regarding configuring the demo for Derby, or am I out there in left field.

Any suggestions appreciated.

Arthur.Blake
24 Apr 2008, 5:11 AM
It's really hard for me to tell why it's not working for you without more information...

Does it work when you point your browser to: http://jabsorb.org/jabsorb-trunk/projectmetrics.html ?

Are there any exceptions on the server side? Any errors in firebug? Does it work in IE or other browser?

Which version of the JDK are you using?

Arthur.Blake
24 Apr 2008, 7:11 AM
Being a first-timer using Derby, can you tell me what might be the obvious regarding configuring the demo for Derby, or am I out there in left field.


The original demo I made created the derby database in a folder called derby under the current folder when you ran 'ant test.dist'.

When you run the webapp, it must be able to find that derby folder. (Also note that you can run the demo by running 'ant run' without installing it into a separate web container. This uses an embedded jetty web server just for demoing. Connect to port http://localhost:8084 to see it...)

I've since updated the demo to instead create the derby database in a folder named .jabsorb under the users home folder (e.g. "~/.jabsorb/derby" on unix or "C:\Documents and Settings\user\.jabsorb\derby" on windows) and the web app also looks here when it starts up. So make sure that your web app starts up as the same user that you used when you built jabsorb, or copy the derby created files over to the proper user location.

You could also modify the code to build and/or use your Derby DB in any other location.
See http://svn.jabsorb.org/websvn/jabsorb/trunk/test/src/org/jabsorb/ext/ProjectMetricsDatabase.java?op=file&rev=0&sc=0
look at the getDerbyFolder() method.

I hope this helps.

jbeasley
3 May 2008, 8:52 AM
Thanks Arthur for responding. I was working with the Demo more this morning and made some progress. My Derby install is probably OK. However I am now getting the error:

jsonrpc.ProjectMetrics has no properties
proxy = new Ext.data.JsonRpcProxy(jsonrpc.ProjectMetrics.queryRecords);

Do you know what this problem could be?

btw - My Java version that you asked about earlier is 1.6.0_05.

Thanks for your help.

azbok
15 Jun 2008, 10:19 AM
Hi, I'm wondering if your version of the filtered grid widget in ProjectMetrics is available anywhere yet?
(I also sent you a PM about it too).

Thanks

seade
22 Oct 2008, 3:13 PM
Hi Arthur. Can you please let us know what license is applied to your JsonRpcProxy class. ASL 2.0 would be nice, LGPL would be okay, but GPL would mean that I cannot use it (even though I have an ExtJS commercial license).

ExtJS licensing is a total shambles.

I too would be interested to see your Projectmetrics example.

Thanks,

Scott

Arthur.Blake
23 Oct 2008, 5:00 AM
I wrote this before ExtJS 2.1 and the big bad license change. At the time I wrote it, I had stated that I was donating it to the ExtJS code base (and thus intended it to be under the LGPL/dual license that ExtJS was under at the time), but there was talk from the ExtJS team about that license never being valid to start with, and I don't think the ExtJS team is really interested in this little bit of code anyway.

I agree the ExtJS license change has caused a lot of confusion and left a lot of people in the cold. That's pretty much why I abandoned the project metrics demo and pulled the plug. I deleted the demo from the jabsorb repository because jabsorb is Apache licensed and I didn't want there to be the slightest question of any mixture or tainting of the licenses.

Since this piece of code is so small, and is really just glue to get the libraries to work together, I see no reason why not to release it as self contained under the most permissive license I can think of. So from now on, this bit of code is under MIT/X11 license. This license is compatible with the GPL and Apache license.

Best wishes.

seade
23 Oct 2008, 12:29 PM
So from now on, this bit of code is under MIT/X11 license. This license is compatible with the GPL and Apache license.
Excellent.

Thank you Arthur.

Scott

mv_Ext
15 Jul 2009, 12:56 PM
I am pretty new to Extjs and am trying to use json-rpc proxy for rpc calls(using jabsorb). I am having trouble in invoking remote methods that take more than one argument. The current scenario is somewhat like this
1. I am trying to load a store with remote data. So i call the load method on the store:
var myRecord = new Ext.data.Record.create([{name : 'column1'},{name: 'column2'}]);
var myReader = new Ext.data.JsonReader(JSONREADER_METADATA, myRecord);
var my_store = new Ext.data.JsonStore({
proxy: new Ext.data.JsonRpcProxy(this.jsonRpcClient.remoteClassName.remoteMethodName),
url: '',
reader: myReader,
fields: myRecord
});

my_store.reader = myReader;
my_store.on('beforeload', function(store, options){
options["params"]= {remoteMethodArguments};
});

Now the backend method signature is something like this:
remoteMethodName(remoteMethodArgument1, remoteMethodArgument2)

How do i send both arguments in options["params"]?
The json-rpc clubs the arguments together into an array, so if i specify
options["params"]={a,b}, the JSON params reaching the server looks like params:[{a,b}], making it a single argument. It should actually look like params:[a,b], to be taken as 2 different arguments by jabsorb.
How can you send more than one argument to a remote method in aone rpc call using Extjs with json-rpc and jabsorb?

samson85
7 Oct 2009, 8:16 AM
2008-04-30 UPDATE:
I've deleted the demo from the jabsorb web site and SVN repository due to ExtJS licensing issues. When I created the code, I was using ExtJS 2.0.2 which I had believed to be licensed under LGPL at the time. Since then, it has come to light that the LGPL licensing being used at that time was really an invalid license and ExtJS is now under a dual GPL/commercial license for ExtJS 2.1. Since jabsorb is under an Apache 2.0 license, the licenses are not compatible. Even though it's just demo code, I want to be absolutely sure I am following all licensing restrictions properly. I am going to create a separate project that is GPL licensed, just for the demo. I will update here again when that is up. Sorry for the confusion...


Sorry, to dig up this old topic. However are you sure that the Apache 2.0 license and GPL v3 are not compatible? According to FSF they are compatible: http://www.fsf.org/licensing/licenses/index_html#GPLCompatibleLicenses. The reason I'm asking is that I'm also using Jabsorb with an ExtJS3-frontend and I also extended HttpProxy and TreeLoader to better integrate Jabsorb into ExtJS. So I hope this is allowed?