Seperating the hosting of the client and server

16 views
Skip to first unread message

Sander Smith

unread,
Sep 1, 2011, 12:07:23 PM9/1/11
to Google Web Toolkit
I'm trying to seperate the client side of my GWT app (the JS files)
from the server side by hosting them in different places. So the
static JS is at www.host1.com and the Java web app stuff is at www.host2.com.
To communicate, I simply pass the fully qualified URL (http://
www.host2.com/...) into setServiceEntryPoint().

Things aren't working, and I don't know why. I've looked through the
documentation to see if this is allowed, and can't find anything that
says it's not. I have a gut feeling that this is violating some sort
of JS security issue, so I wanted to check before continuing.

Am I able to do what I want?

Thomas Broyer

unread,
Sep 1, 2011, 12:18:43 PM9/1/11
to google-we...@googlegroups.com


On Thursday, September 1, 2011 6:07:23 PM UTC+2, Sander Smith wrote:
I'm trying to seperate the client side of my GWT app (the JS files)
from the server side by hosting them in different places. So the
static JS is at www.host1.com and the Java web app stuff is at www.host2.com.
To communicate, I simply pass the fully qualified URL (http://
www.host2.com/...) into setServiceEntryPoint().

Things aren't working, and I don't know why.

"Same Origin Policy"
 
I've looked through the
documentation to see if this is allowed, and can't find anything that
says it's not. I have a gut feeling that this is violating some sort
of JS security issue, so I wanted to check before continuing.

Am I able to do what I want?

If your HTML host page is on host1, then you won't be able to use GWT-RPC, RequestFactory or RequestBuilder to communicate with host2 (well, that's not entirely true, but if IE is to be supported, then consider it's simply not possible).

You can however deploy your HTML host page on host2 and your JS at host1. You'll have to use the "xsiframe" linker for your code to be loaded in the web page though, but it's as easy as adding a line to your gwt.xml:
<add-linker name="xsiframe" />

Sander Smith

unread,
Sep 2, 2011, 10:23:53 AM9/2/11
to Google Web Toolkit
Thanks, that's what I was looking for.

By adding the linker code in I was able to serve the HTML file the
Servlet server, and the static JS stuff from a completely different
domain. Not really so intuitive, but I understand that ultimately this
isn't a GWT issue but more like a browser issue.

On Sep 1, 12:18 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Thursday, September 1, 2011 6:07:23 PM UTC+2, Sander Smith wrote:
>
> > I'm trying to seperate the client side of my GWT app (the JS files)
> > from the server side by hosting them in different places. So the
> > static JS is atwww.host1.comand the Java web app stuff is at
Reply all
Reply to author
Forward
0 new messages