Simple component you may use for downloading files from other servers. For example it could be useful if you points in your applications (JSP pages) to mp3 files located on the remote host etc. How to use it: 1) download rdownloadPackage.jar and save it in WEB-INF/lib 2) describe RemoteDownload servlet in web.xml file
<servlet> <servlet-name>RemoteDownload</servlet-name> <servlet-class>com.jsos.download.RemoteDownloadServlet</servlet-class> </servlet> 3) define a mapping:
<servlet-mapping> <servlet-name>RemoteDownload</servlet-name> <url-pattern>/servlet/RemoteDownload</url-pattern> </servlet-mapping> and now you can use it:
http://your_host/servlet/RemoteDownload?http://some_uri_here servlet will download this file from the remote host. You may set initial parameters with proxy settings for your host. Names for parameters are proxyHost and
proxyPort. For example:
<servlet> <servlet-name>RemoteDownload</servlet-name> <servlet-class>com.jsos.download.RemoteDownload</servlet-class> <init-param> <param-name>proxyHost</param-name> <param-value>ip_address_for_your_proxy</param-value> </init-param> <init-param> <param-name>proxyPort</param-name> <param-value>8080</param-value> </init-param> </servlet> You can provide the following additional parameters for this servlet: gzip - enable/disable data compression during the downloading. Possible values
are true and false. Default value is false
For example:
<servlet> <servlet-name>RemoteDownload</servlet-name> <servlet-class>com.jsos.download.RemoteDownloadServlet</servlet-class> <init-param> <param-name>gzip</param-name> <param-value>true</param-value> </init-param> </servlet> For downloading: servlet: rdownloadPackage.jar
See also JSOS - the largest collection of servlets and filters.
|
Also in JSOS:
|