Stupid SOP and GWT Proxy Service

So for our fourth year design project, our team is building a tournament management system using Ruby on Rails. However part of the rails application is the design of a RESTFul API that can accommdate the addition of plugins so developers can customize perhaps the look & feel of their own tournament type.

In order to support plugins that are not published/offered on our web-server, we’ve had to circumvent the SOP (same origin policy). This is my real first foray into web development and I’ve been pulling my hair almost the whole way, including having to work around SOP. Since we allow plugins to perform POST as well GET, using JSONP was not a suitable solution to the problem. In development of one of the plugins built using GWT, we’ve decided to build a proxy server using the Remote Procedure Calls provided by GWT.

Essentially GWT has functionality for creating RemoteServices that perform RPC from the client to the server, however it is the server with respect to the plugin and not the server they’d like to perform the HTTP requests.

Essentially, we’d created a ProxyService RPC which when in the server performs the necessary HTTP request (since no longer in client, they are not subject to SOP).

Essentially, although the RemoteServices by GWT are Async, we’ve included a synchronous call using Java’s HttpURLConnection class. The reading/writing returned by the server happen to be JSON which we’ve wrapped in Strings, which are automatically Serializable to the RPC in GWT, making the overall design of the proxy server pretty straightforward. We found a lot of missing (hard to find) documentation on what to set the request properties for each HTTP request. We ultimately found the proper one’s, through trial and error.

In other news…

I’m going to Burnaby, BC to work on an upcoming video game title for Blue Castle Games, which is a independent video game studio. I’ve also seen great GDC videos I hope to comment on through some upcoming posts as well as through my previous term at Digital Extremes.

One Reply to “Stupid SOP and GWT Proxy Service”

  1. We have also been doing this for a while, and have developed a sddaeraniztd method ( ) for transferring data to our GWT modules via our JSPs.It would be great if GWT supported serializing objects into JSPs or Servlets at runtime to cut down on the amount of JSON manipulation that can be required to transfer complex data sets this way.Official support for something along the lines of what or would provide a great method for speeding up module startup when using JSPs or Servlets.

Leave a Reply

Your email address will not be published. Required fields are marked *