Hello Everyone,
I would like to deploy a filter to log requests to all
jsp's located within a sub directory of the applications context root .
Here is the scenerio:
Context root : testapp
Required : Filter requests to all jsp's in testapp/admin/ for example testapp/admin/manage.jsp
I configured the following in web.xml:
<filter-mapping>
<filter-name>superfilter</filter-name>
<url-pattern>/admin/*.jsp</url-pattern>
</filter-mapping>
But the app server throws an exception : . . . . . . + "Invalid <url-pattern> /admin/*.jsp in filter mapping" . . . .
When I change to
<filter-mapping>
<filter-name>superfilter</filter-name>
<url-pattern>/admin/*</url-pattern>
</filter-mapping>
everything works fine. But I observed that the filter is applied to everything not just jsp's, implying that for a request for a jsp, the filter is applied to associated sub-requests for images(gif, jpg) etc contained on that jsp page. Also request for static html files are similary filtered. This I would like to avoid by filtering only requests for files with .jsp extension.
Also, the config below works.
<filter-mapping>
<filter-name>superfilter</filter-name>
<url-pattern>/*.jsp</url-pattern>
</filter-mapping>
But this applies the filter to all jsp files in the application, not only jsp's in the admin subdirectory as I require.
Can anybody see what I am doing wrong or how to solve my problem ?
Thanks in advance.