cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect Alfresco with GWT RPC

jeanmonod
Champ in-the-making
Champ in-the-making
Hi all,

I'm develloping a web client using Google Web Toolkit. GWT has a great way to communicate with the server call GWT RPC. With this you can write your client-side code in java and in the server-side in a java-servlet, using the same java class in both side and transfering object form server to client, or from client to server, staying in pure java. You don't have to worry about json parsing or anything else. And you can share a common interface, that a great plus from a dev perspective.

My problem is that from my server side, I'm inside a servlet. And I don't know what is the best way to query my Alfresco repository from this servlet. I see some possibilities but I'm not sure which one to use or even which is the best. What I have imagine:

* Package my servlet inside the same war as Alfresco (using an AMP for exemple) and then query the repository with API Fundation. But I'm not sure if I'll be able to access the servlet as I should modifie the Alfresco web.xml (Is there a safe way to do that).

* Package my servlet in a new war, and query the repository with  API Fundation.

* Not using the API Fundation, but the Web Service API, but this seems not optimized as I know that I will stay on the same server.

* Extending the Webscript in order to return what GWT RPC is expecting. But this seems quite complicated…


So, my question is what would you do in such case?

Thanks if someone have an idee…

David
2 REPLIES 2

t_broyer
Champ in-the-making
Champ in-the-making
I'm develloping a web client using Google Web Toolkit. GWT has a great way to communicate with the server call GWT RPC. With this you can write your client-side code in java and in the server-side in a java-servlet, using the same java class in both side and transfering object form server to client, or from client to server, staying in pure java. You don't have to worry about json parsing or anything else. And you can share a common interface, that a great plus from a dev perspective.

RPC (whichever one: GWT-RPC, XML-RPC, SOAP, etc.) always come with tooling that greatly enhance productivity. But RPC still is RPC and doesn't scale as well as ROA, which HTTP and the Web are about.

So qualifying any form of RPC-over-HTTP "great" is wrong (or really a matter of personal taste…)

My problem is that from my server side, I'm inside a servlet. And I don't know what is the best way to query my Alfresco repository from this servlet. I see some possibilities but I'm not sure which one to use or even which is the best. What I have imagine:

* Package my servlet inside the same war as Alfresco (using an AMP for exemple) and then query the repository with API Fundation. But I'm not sure if I'll be able to access the servlet as I should modifie the Alfresco web.xml (Is there a safe way to do that).

If you stick to using GWT-RPC, that's the way to go IMO.

And no, there's no "safe" way to update the web.xml (that I know of)

* Package my servlet in a new war, and query the repository with  API Fundation.

Would it even be possible? (without Java RMI)

* Not using the API Fundation, but the Web Service API, but this seems not optimized as I know that I will stay on the same server.

* Extending the Webscript in order to return what GWT RPC is expecting. But this seems quite complicated…

So, my question is what would you do in such case?

I'd use webscripts producing JSON or XML and taking application/x-www-form-urlencoded and/or multipart/form-data as input (actually, that's what we're doing already in our GWT+Alfresco dev).

Note that it's also the way Share communicates with the Alfresco repository, so it's definitely the way to go IMO.

jamesgustard
Champ in-the-making
Champ in-the-making
We used  OpenCMIS to call the Alfresco Webscripts, its works well. You can read more on our Nexus blogg…

http://46.137.187.137/wordpress/?p=225