1

我正在尝试实施此链接上建议的工作 http://raibledesigns.com/rd/entry/how_to_do_cross_domain 我的服务器上现有的 Servlet 看起来像

@SuppressWarnings("serial")
public class ContactsServiceImpl extends RemoteServiceServlet  implements ContactsService   
{
 ...

如何修改它以使跨域工作。我需要在客户端进行任何更改吗?

4

1 回答 1

0

It isn't the GWT Same Origin Policy - it is the browser itself! The browser won't normally allow any XHR call to go out to a server that isn't the same server the page was loaded from.

The link you mentioned lets your server act as a proxy - thats one way to let the client talk to another server. The steps they take (create a servlet that forwards requests, configure it to point at the other server you want to use) do not require changes to the client.

Another option is to use the Cross Origin Resource Sharing - a way for the server to specify that the browser is allowed to contact it, even across domains. The catch: not all browsers support it.

于 2013-01-17T01:35:51.920 回答