A simple component you may use for the secure files downloading. The usage is:
Servlet will find this some_key in the text (properties file) and get the real location (as well as a name) for the downloaded file. And this text file will be provided as an initial parameter for this servlet. Parameter name is base.
a) copy secureDownloadPackage.jar into WEB-INF/lib directory
b) describe this servlet in your web.xml file:
<servlet>
<servlet-name>SecureDownload</servlet-name>
<servlet-class>com.jsos.secure.SecureDownloadServlet</servlet-class>
<init-param>
<param-name>base</param-name>
<param-value>full_path_to_your_properties_file</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SecureDownload</servlet-name>
<url-pattern>/servlet/SecureDownload</url-pattern>
</servlet-mapping>
Properties file is a text file, each line describes one file in the form of
your_key=real_path_to_your_file
Empty lines and any line starts with # or // are ignored. You can use file path as well as URI here.
For example:
In this case for example http://your_host/servlet/SecureDownload?key2 will actually download the file from http://myhost/mydir/picture.mp3
Note: the evaluation version supports up to 5 keys in the properties file.
For downloading:
servlet: secureDownloadPackage.jar
© Coldbeans
Comments?
See also JSOS - the largest collection of servlets and filters.