Gwt RPC services, spring and hibernate

22 views
Skip to first unread message

ahmet kara

unread,
Jul 14, 2011, 9:11:28 AM7/14/11
to gwt4air
Hi,

I run a web application with air like in setup.doc, but can't I user
spring,hibernate or gwt rpc services??

Thankss??

nino

unread,
Jul 14, 2011, 12:01:46 PM7/14/11
to gwt...@googlegroups.com
Remember that an AIR application is a stand alone application. So the use GWT RPC inside AIR you need to do 2 things.

1) give gwt4air jar file a higher priority then GWT in your eclipse project.
gwt4air ships with a patch of the Requestbuilder class to make it work inside air.
So your application will use the Requestbuilder class from gwt4air instead of the one from GWT.

2) You nee to change  the ServiceEntrypoint of your RPC-Interface. So you need to do something like (using  the default rpc example that comes with gwt) :

public static void sendNameToServer(String name) {
if (Runtime.isAIR()) {
ServiceDefTarget endPoint = (ServiceDefTarget) greetingService;
String serviceEntryPoint = endPoint.getServiceEntryPoint();
serviceEntryPoint = serviceEntryPoint.replaceFirst("app:/", "http://127.0.0.1:8888/");
endPoint.setServiceEntryPoint(serviceEntryPoint);
}

  //rest code here 
}

note the line in bold
for AIR i changed to serviceEntrypoint to "app:/". Because that s where the AIR application is located.
Also  http://127.0.0.1:8888/ is because the application is running locally. For a productive application you will have  the production url there.

after that you can process as usual

greetingService.greetServer(name, new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
}

public void onSuccess(String result) {
}
});

hope this help.

Alain Ekambi

unread,
Jul 14, 2011, 12:22:37 PM7/14/11
to gwt...@googlegroups.com
Gwt4air 1.0 actually ships with an AIR application with source code illustrating a lot of example. But i removed it starting with version 2.0. 
Maybe i should add a  new AIR application to the next release to illustrate how to use the air package ? 

2011/7/14 nino <jazzma...@googlemail.com>



--


nino

unread,
Jul 17, 2011, 4:08:01 PM7/17/11
to gwt...@googlegroups.com
For the other following this issue. Ahmet PMd me that the issue is now fixed.
Reply all
Reply to author
Forward
0 new messages