tags:

views:

984

answers:

2

Is there a way I can make a request to a different server than the one that's being used for development using a RequestBuilder?

I keep getting

com.google.gwt.http.client.RequestPermissionException: The URL
http://127.0.0.1:4321/getSellers is invalid or violates the same-origin
security restriction

while I am sending request from 127.0.0.1:8888

A: 

There is a detailed explanation on the topic of the Same Origin Policy and its consequences for developing with GWT here:

http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/FAQ_SOP

The simple answer is: No, that's something that is disallowed for security reasons. However, it should be possible to work around this limitation with all kinds of techniques (proxy servers, Yahoo Pipes, etc). As I'm no AJAX expert, I will leave the explanation of those to others.

springify
+1  A: 

GWT currently doesnt support cross domain ajax calls - but it can be worked around if you are willing to do a bit of jsni. And I heard a rumour some time ago that there is a gwt patch with the solution, but its not perfect. see this http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/94c18c4ec158070c/

to work around using jsni, you can use whats called the windows.name transport - see this blog http://www.sitepen.com/blog/2008/07/22/windowname-transport/ . i havent been able to locate a library for gwt to automate this, but i dont think its too hard to do yourself in jsni (and dont me misled by the blog being about dojo, its a general technique).

Chii