How to host GWT app on remote server

233 views
Skip to first unread message

dhoffer

unread,
Mar 3, 2012, 10:02:41 AM3/3/12
to Google Web Toolkit
I have a case where I'd like to use GWT to create a small part of an
existing HTML page/app, however that server doesn't have a J2EE server
to host the GWT app. How can I host the GWT app on a different
server? I.e. I have full control over changing the HTML page to do
whatever..how can I modify this to load GWT bootstrap file that is on
a different server?

David Hoffer

unread,
Mar 3, 2012, 11:32:43 AM3/3/12
to Google Web Toolkit
I read at http://code.google.com/webtoolkit/doc/latest/tutorial/Xsite.html
a discussion about this.

I like the second option of dynamically loading javascript in a script
tag. However its not clear to me if I can do what I want. That
discussion is for the stock watcher application which I don't know
anything about...but it seems like they are just getting the JSON
response? I want to host both the UI and server code on a remote
server, seems like I should be able to use this approach to download
all of the UI code...but then can the downloaded UI code make RPC
calls to the remote server? I wish GWT would have discussed if this
approach can be used for any GWT app.

Thomas Broyer

unread,
Mar 3, 2012, 7:20:08 PM3/3/12
to google-we...@googlegroups.com
For JSON-P, have a look at the JsonpRequestBuilder: http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/jsonp/client/JsonpRequestBuilder.html

There's also http://code.google.com/p/gerrit/source/browse/?repo=gwtjsonrpc which does JSON-RPC with support for cross-site requests; it has the advantage of using a similar API to GWT-RPC and provide server-side foundations.

dhoffer

unread,
Mar 4, 2012, 2:07:54 PM3/4/12
to Google Web Toolkit
Thomas,

Thanks for the info...gwtjsonrpc looks especially interesting.

However these solutions seem to be at the RPC level...e.g. to allow
cross site RPC calls. What about the GWT UI? How does the GWT UI get
mashed with the host site? Seems like the GWT war would have to be
split with its client code still hosted by the main hosting site?
Maybe I'm missing something here? Can someone elaborate how this type
of thing would get deployed? The goal is to keep all of the GWT war
remote...as much as possible.

What about CORS...does that help?

-Dave

On Mar 3, 5:20 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> For JSON-P, have a look at the
> JsonpRequestBuilder:http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/googl...
>
> There's alsohttp://code.google.com/p/gerrit/source/browse/?repo=gwtjsonrpcwhich
> does JSON-RPC with support for cross-site requests; it has the advantage of
> using a similar API to GWT-RPC and provide server-side foundations.
>
>
>
>
>
>
>
> On Saturday, March 3, 2012 5:32:43 PM UTC+1, dhoffer wrote:
>
> > I read athttp://code.google.com/webtoolkit/doc/latest/tutorial/Xsite.html
> > a discussion about this.
>
> > I like the second option of dynamically loading javascript in a script
> > tag.  However its not clear to me if I can do what I want.  That
> > discussion is for the stock watcher application which I don't know
> > anything about...but it seems like they are just getting the JSON
> > response?  I want to host both the UI and server code on a remote
> > server, seems like I should be able to use this approach to download
> > all of the UI code...but then can the downloaded UI code make RPC
> > calls to the remote server?  I wish GWT would have discussed if this
> > approach can be used for any GWT app.
>

Thomas Broyer

unread,
Mar 4, 2012, 2:28:54 PM3/4/12
to google-we...@googlegroups.com


On Sunday, March 4, 2012 8:07:54 PM UTC+1, dhoffer wrote:
Thomas,

Thanks for the info...gwtjsonrpc looks especially interesting.

However these solutions seem to be at the RPC level...e.g. to allow
cross site RPC calls.  What about the GWT UI?  How does the GWT UI get
mashed with the host site?  Seems like the GWT war would have to be
split with its client code still hosted by the main hosting site?
Maybe I'm missing something here?  Can someone elaborate how this type
of thing would get deployed?  The goal is to keep all of the GWT war
remote...as much as possible.

The UI is built by your *.nocache.js and *.cache.* scripts. If you use the xsiframe linker, you can load the code from whatever server and it'll "just work".

Integrating into a non-empty HTML page is as easy as using RootPanel.get("some-element-id") as the root(s) for your UI.

What about CORS...does that help?

That'd help for communicating with your server (RPC), without the need for JSON-P or similar, but obviously won't work with IE (until IE10 is widespread). 
Reply all
Reply to author
Forward
0 new messages