Content Transformer Servlet Filter
From bemoko developer wiki
Available since bemokoLive v1.2.8
Introduction
If you are already using a Java server (i.e. servlets or JSPs with frameworks such as struts, spring or stripes) to deliver web pages to your PC then it is one small step to make your content ready for mobile with bemokoLive.
You can use a servlet filter that captures your PC markup and sends it to a bemokoLive site to mobilise it. If the connecting user agent is a PC one then content is sent through as is - otherwise the mobilised content provided by bemokoLive is passed through.
Configuration
Web Application
In your web.xml file for your web application include the configuration for the bemokoLive ContentTransformer as follows:
<filter> <filter-name>ContentTransformer</filter-name> <filter-class>com.bemoko.live.client.servlet.ContentTransformerFilter</filter-class> <init-param> <param-name>bemoko.service.endpoint</param-name> <param-value>http://localhost:8080/live/adapt-pc-site/test/render</param-value> </init-param> </filter>
where bemoko.service.endpoint defines the location of your bemokoLive transformation service. You can set up a bemokoLive transformation service by using the adapt-pc-site plugin. Map this filter to the appropriate URLs, e.g. :
<filter-mapping> <filter-name>ContentTransformer</filter-name> <url-pattern>/test/*</url-pattern> </filter-mapping>
and then spin up your web application.
Url Rewriting
Since bemokoLive naturally deals with the delivery of media assets, such as images, and style sheets to mobile devices, you may also like bemokoLive to deal with the delivery of these for the mobile devices. This can be achieved with the inclusion of a tweaker that rewrites the URLs for images and style sheets to an web server context which is mapped to bemokoLive and leaves page links as is. The page links will need to stay as they are because you will want the links to route the user back through your web application.
An example of this tweaker will be provided soon
