?, java problems tips" /> ?. Get java problems tips from javaproblemstips.info" />

Interceptor problem, how to intercept static resource file access requests ?

Category: Web Develop
2008-12-16 03:52:59

Sponsored Links
The original project all the resource files such as pictures, documents, etc. are in the page file directly to the server storing the actual path example: a page image <img src = "/ images/user001photo.jpg "/>, in which the system's images web root directory does have a user001photo.jpg file,
now for some reason all the resource files into web directories outside of the local management that is unrelated to the directory and web sites (mainly for the convenience of the backup, because these pictures are user pass up).
Now I want without modifying the original path through the interceptor to capture this resource will be processed by the program after the visit associated resource files and then output (or directly copied to "/ images under ).
I use the following method, first in web.xml add an interceptor
<filter-name> resFilter </ filter-name>
< filter-class> interceptor.ResourceFilter </ filter-class>
<filter-name> resFilter </ filter-name>
<url-pattern> / images / * </ url-pattern>
</ filter-mapping>

interceptor class ResourceFilter in the doFilter method to intercept access to post-processing. But does not actually intercept, I think my url-pattern wording should be no problem, why not intercept "/ images/user001photo.jpg" this path access it?
Environment: jdk1.6 tomcat6

Sponsored Links

2008-12-16 03:55:49
interceptors should be no problem, ...........
2008-12-16 04:00:46
view on the information you provide , no problem
2008-12-16 04:12:24
interceptor is written so the amount
2008-12-16 04:26:58
interceptor wording no problem, I suggest you try another browser
2008-12-16 04:46:44
wow, no one knows do?
2008-12-16 05:03:13
interceptor is written so hungry
2008-12-16 05:05:17
changed Firefox, Apple browsers will not work, depressed.
2008-12-16 05:22:40
today, tried it and found the problem, but can not understand.
the filter criteria to <url-pattern> / * </ url-pattern>
and then the picture on the website root directory, can be intercepted. If you do not put pictures on the web site root directory, still can not intercept.
strange strange! / * Block all access paths can not do? In order not to intercept / images / ...?
conditional can help you try, depressed ah ......
2008-12-16 05:41:39
solve the problem, the tomcat server.xml configuration file settings problem, but do not understand the original settings Why can cause problems.
but not affix, anyway, a change of configuration on it.
Results posted scattered points!
2008-12-16 05:58:35
landlord can ask is how to configure server.xml?
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.