Static Map proxy servlet ver. 1.2


This servlet lets you transparently pass all the incoming requests to the Google static Maps service. Servlet simply performs a role of HTTP proxy for your requests.

The Google Static Maps API lets you embed a Google Maps image on your web page without requiring JavaScript or any dynamic page loading. The Google Static Map service creates your map based on URL parameters sent through a standard HTTP request and returns the map as an image you can display on your web page.

Why you might need this proxy? It is actually a cache for the maps. Also - there is one interesting usage (e.g. it is used in our Places for Facebook mashup). Strange, but you cannot post Google Static Maps to Facebook. Results are strange - sometimes it works, sometimes - does not. This proxy lets you include Google Static Maps from your site.

How to use proxy servlet:

a) download staticMapPackage.jar and save it in WEB-INF/lib

b) describe this servlet in web.xml file. Servlet accepts the following initial parameters:
proxyHost - Optional parameter. Describes a proxy host for your internet connection
proxyPort - Optional parameter. Describes a proxy port for your internet connection
 


<servlet>
  <servlet-name>StaticMap</servlet-name>
  <servlet-class>com.jsos.staticmap.StaticMapProxyServlet</servlet-class>
</servlet>

c) describe a mapping for this servlet in web.xml file. E.g.:
 


<servlet-mapping>
  <servlet-name>staticMap</servlet-name>
  <url-pattern>/servlet/staticmap</url-pattern>
</servlet-mapping>

and now you can request static map by this way:
 

http://your_host/servlet/staticmap?center=55.78808,37.55019&zoom=13&size=90x90 &sensor=false

Also you can describe the proxy settings for the servlet itself. Parameters are proxyHost and proxyPort. E.g.:
 


<servlet>
  <servlet-name>StaticMap</servlet-name>
  <servlet-class>com.jsos.staticmap.StaticMapProxyServlet</servlet-class>

<init-param>
  <param-name>proxyHost</param-name>
  <param-value>10.114.7.95</param-value>
</init-param>

<init-param>
  <param-name>proxyPort</param-name>
  <param-value>80</param-value>
</init-param>
</servlet>

   For downloading:

    Static Map proxy package:  staticMapPackage.jar
 

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

     

Also in JSOS: