Force Download Servlet v. 1.2

Here is a useful component for delivering multimedia file downloads to your users. Typically, browsers will attempt to play or stream such files when direct links are clicked. With this servlet, provide a link to a multimedia file and a dialogue box will provide users the choice of saving the file or opening it. Technically this servlet will set content type to the downloaded media files to application/octet-stream (or any other type you can provide as an initial parameter for this servlet) regardless of the mime type provided by the server. How to use it:

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

2) describe ForceDownload servlet in web.xml file. You can add also an optional initial parameter mime. Default value is application/octet-stream  


3) define a mapping. E.g.:


and now for any mp3 file requested from your site:


this servlet will set mime type to application/octet-stream (force file downloading rather than playing).

For JSP see also Download taglib in Coldtags suite

For downloading:

servlet: forcedownloadPackage.jar  

 © Coldbeans    Comments?

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


Also in Coldtags: