Wednesday, November 25, 2009

Using the Google Data APIs Java Client in GWT Hosted Mode

After Long Fight with GWT Hosted Mode setup at last I could solve the problem accessing GData Content using GData Java Client Library. You can always have nice and working setup for your Console or Java Client Apps by following the steps below ..


But above steps doesn't help when you run the same Code in GWT Client / Server :( ..
Almost after 3 days of long fight with web search and heat and trial options found the solution, hope it helps to my fellow colleague and friends .

1 . You must follow the above steps suggested by Google for sure..
2. Add google-collect-1.0-rc1.jar also as external libray in your eclipse project
3. Put all the gdata* jar files in your project \war\WEB-INF\lib folder
4. Add line <property name="com.google.gdata.DisableCookieHandler" value="true"/> in your project's appengine-web.xml file (No Idea what is the side effect with this fix)

Hurrey !!!! You are ready to use any Google services class in your app engine :)

You can end up facing similar problem while using the Raw java class HttpURLConnection..
I could successfully create a http connection by adding a simple line httpConnection.setRequestMethod("GET"); for example the below lines of code works fine in GWT while accessing any Google Feeds.

HttpURLConnection httpConnection = (HttpURLConnection)url.openConnection();
httpConnection.setRequestMethod("GET");

No comments:

Post a Comment