adding a proxy host to vaadin app

I’m using the openlayers add-on and as part of that I need a proxy host on the local server. So the pattern (as I understand it, I’m fairly new to these things) is

  1. javascript within openlayers wants to get some map data from a foreign server
  2. within openlayers the call is intercepted with the ProxyHost setting and directed instead to the local server
  3. local server is the Vaadin app - so something in the vaadin server needs to receive that proxy request and relay it onto the map server, return result to the openlayers.

I think I’ve figured out how to setup the proxy invocation on the openlayers side, but I’m completely at a loss as to how to make a vaadin app handle the proxy call. (I was attracted to Vaadin precisely to avoid too steep a learning curve on all this stuff :slight_smile: j )

Any suggestions please?



Requirement to use proxy should be very rare with Vaadin, as most often web services are consumed directly from server. With OpenLayers you might need if you are using WFS layer “directly from the browser”. In this case you need it to circumvent SOP. Most base layers don’t need it (unless you wish to cache e.g. cache tiles on a local server).

If you want to make proxy directly into Vaadin app, you could use URIHandler. But IMO the easiest methods is to use ProxyServlet from jetty-utils package (might have changed in jetty 8). It is flexible enough and can be easily configured next to a Vaadin servlet. No coding necessary, but you just need to define the target url in you web.xml file. See e.g. this wiki page: