Proxy Servlet for GWT in devmode

One of the problems with using GWT is that when you run in devmode, GWT manages its own instance of a Jetty server (I think it’s a Jetty server anyway). Unless you want to use GWT’s own server implementation, and perhaps even run in on Google AppEngine, you’re going to run into the same origin policy. In order to get around this problem, you have to set up a proxy server of some sort.

This article was originally written on 2010-04-12, but after I reset my website I was asked to republish it. Original article can be found here, courtesy of archive.org.

I found a bit of servlet code written by Stou Sandalski which allows you to do this, made to solve the exact same problem in fact. However, I wanted a proxy which would not only support GET and POST requests, but basically allow me to do whatever I wanted. I also wanted it to send all request headers across to the target server. The only dependency is Apache HttpCore and HttpClient.

Once that’s up and running, you need to add something along these lines to your web.xml in the WEB-INF directory:

5 Responses to “Proxy Servlet for GWT in devmode”

  1. Kevin

    Wow 0.0 didn’t expect that to work thanks a lot!

    Reply
  2. fabi

    But how to use it in GWT after ? can u give an example please, i am lost as the method is protected….

    Reply

Leave a Reply