One time download servlet v. 1.1

This component lets you provide such a service as one time downloading. Suppose your application creates some file that will be available for the downloading only once and should be automatically deleted after the downloading. For example almost all of the services for the music/pictures/games downloading on the mobile phones work so. That is what this servlet is for. How to use it:

1) download oncedownloadPackage.jar and save it in WEB-INF/lib

2) describe OnceDownload servlet in your web.xml file


3) define a mapping:


and now you can use it:


servlet will download this file from the server. By default servlet will search file in the root (docBase) directory of your servlet container. You may set an initial parameter described another directory on your server. Parameter name is dir. For example:


and this directory (file store) could be located even the outside of your web application.

Also you can provide the following parameters for this servlet:

error - lets you describe some URL users requests will be redirected to in case of missed files. If this parameter starts with http:// than servlet redirects the request. Otherwise servlet assumes the local resource and request will be forwarded. By default is empty (no redirection).
gzip - enable/disable data compression during the downloading. Possible values are true or false. Default value is false.

For downloading:

servlet: oncedownloadPackage.jar  

 © Coldbeans    Comments?

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

Also in Coldtags: