This is a Java servlet filter (as per Servlet API 2.3). This filter lets you protect some files on your server (web application) from the direct access. For example in your Struts application you need to prohibit the direct access to JSP files etc. How to use it: a) download fileaccessflt.jar and save it in WEB-INF/lib b) describe this filter in web.xml. Filter accepts two initial parameters. Parameter
protect describes a commas separated list of extensions for protected files. Parameter
exclude describes a commas separated list of files where direct access is allowed
(in other words being excluded from the protection schema).
<filter> <filter-name>FileAccessFilter</filter-name> <filter-class>com.cj.fileaccess.FileAccessFilter</filter-class> </filter> or (close JSP and HTML files for example):
<filter> <filter-name>FileAccessFilter</filter-name> <filter-class>com.cj.fileaccess.FileAccessFilter</filter-class> <init-param> <param-name>protect</param-name> <param-value>jsp,html,htm</param-value> </init-param> </filter> c) describe a mapping for this filter in web.xml. E.g.:
<filter-mapping> <filter-name>FileAccessFilter</filter-name> <url-pattern>*</url-pattern> </filter-mapping> in this example filter will be on for the each file on your server. Note: filter returns HTTP code 403 for protected files. For downloading: File access package: fileaccessflt.jar
See also JSOS - the largest collection of servlets and filters.
|
Also in Coldtags:
|