I am using Glassfish v3.1 for a Java web application, which gets data from other servers as well. One of these servers is running Geoserver GIS. I can only have the Glassfish server on a public IP.
In order to load a map image, I can call from the JSF pages or any HTML page something like:
http://10.10.10.10:1234/map/query?someparameters&format=image/jpeg
which returns a jpeg image.
If I hardcode this into the pages, it works fine locally (i.e. when 10.10.10.10 is accessible by the browser) but of course fails remotely.
Other than grabbing the image as a file/stream through a bean and then serving it to the server, is there a simpler way to serve these images through the web server? Ideally using Glassfish as some kind of proxy that pushes all request for say http://myserver.com/map to http://10.10.10.10:1234?
HTTP Proxy Servlet looks like it will do what you are looking for. There are likely to be other methods (like putting GF and the geoserver behind an Apache server and using mod_proxy) that would work, too.