This servlet lets you produce QR codes for text. QR codes are a type of two-dimensional barcode. They are also known as hardlinks or physical world hyperlinks. QR Codes store up to 4,296 alphanumeric characters of arbitrary text. This text can be anything, for example URL, contact information, a telephone number etc. Internally servlet uses Google Charts API and caches data for the better performance. How to use this servlet: a) download qrcodePackage.jar and save it in WEB-INF/lib b) describe this servlet in web.xml file. Servlet accepts the following initial parameters:
For example:
<servlet> <servlet-name>QRCodeServlet</servlet-name> <servlet-class>com.jsos.qr.QRCodeServlet</servlet-class> <init-param> <param-name>dir</param-name> <param-value>/my_cache</param-value> </init-param> </servlet> c) describe a mapping for this servlet in web.xml file. E.g.:
<servlet-mapping> <servlet-name>QRCodeServlet</servlet-name> <url-pattern>/servlet/qrcode</url-pattern> </servlet-mapping> and now in your applications you can use servlet in the following forms
/servlet/qrcode?your_url or
/servlet/qrcode?your_encoded_data e.g. <img src="/servlet/qrcode?http://www.servletsuite.com"/> and you will get the following image:
One interesting feature - you can use this servlet without parameters. In this case it will create QR-code for URL from referrer header. This option lets you simply add servlet's image to any page get it's QR-code: <img src="/servlet/qrcode"/> You can describe also the proxy settings for the servlet itself.
Parameters are proxyHost and proxyPort. E.g.:
<servlet> <servlet-name>QRCodeServlet</servlet-name> <servlet-class>com.jsos.qr.QRCodeServlet</servlet-class> <init-param> <param-name>dir</param-name> <param-value>/my_cache</param-value> </init-param> <init-param> <param-name>proxyHost</param-name> <param-value>192.168.0.1</param-value> </init-param> <init-param> <param-name>proxyPort</param-name> <param-value>8080</param-value> </init-param> </servlet> For downloading: QR code servlet: qrcodePackage.jar
See also JSOS - the largest collection of servlets and filters.
|
Also in JSOS:
|