Transcoder Filter ver. 1.5

This is a Java servlet filter (as per Servlet API 2.3). Transcoder lets you convert on the fly your HTML content to WML. So this filter is a quick way to make your site readable from WAP phones. Filter detects who is request's originator: desktop browser or WAP browser. For desktop browser your request will be passed by the normal way and for WAP browser filter will convert on the fly your HTML output into appropriate set of WML pages.

You have to provide two initial parameters for this filter: directory on your server for saving WML cards (dir) and URL for access to this directory (url). For example suppose the root directory on your server is /wwwroot and your server is http://www.acme.com. You may create a subdirectory wmldata for wml data and define for filter two parameters: /wwwroot/wmldata as a directory and http://www.acme.com/wmldata as an URL. Data directory will be cleared before the first usage.

How to use it:

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

b) describe this filter in web.xml. The name for initial parameter is config. Parameter value is path to XML file where you describe you cache policy.
 


<filter>
  <filter-name>trancoderFilter</filter-name>
  <filter-class>com.cj.h2w.transcoderFilter</filter-class>
  <init-param>
    <param-name>dir</param-name>
    <param-value>your_data_directory</param-value>
  </init-param>
  <init-param>
    <param-name>url</param-name>
    <param-value>url_for_access_to_data_directory</param-value>
  </init-param>
</filter>

c) describe a mapping for this filter in web.xml
 


<filter-mapping>
  <filter-name>transcoderFilter</filter-name>
  <url-pattern>*.jsp</url-pattern>
</filter-mapping>

in this case filter will be on for the each .jsp file

And now when you invoke any .jsp page: http://your_host/your_page.jsp from WAP browser transcoderFilter will convert on the fly your HTML output to WML. So you can make all your existing JSP pages readable with WAP/WML mobiles just by adding several new lines to web.xml!

Notes:

All files from data directory will be deleted!

   For downloading:
    Filter:  towmlflt.jar
 

 ©  Coldbeans     Comments?

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