|
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 webpage 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. The Google Static Maps API requires a Maps API key. And this API key is connected with some domain. So if you are distributing your map it could be requested from other domain. This proxy lets you always perform request from your domain. 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:
<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?key=your_key&maptype = mobile&markers = 40.8403347,-82.2393255 &size=240x320&zoom=16
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
See also JSOS - the largest collection of servlets and filters.
|
Also in JSOS:
|