Forums Register Login

web.xml question

+Pie Number of slices to send: Send
I have a web application that has 2 filters and a welcome file
configured in the web.xml. The filters work when the url running the
app explicitly contains a page, i.e. http://xxx/webapp/page.jsp. If
the url doesn't contain a page, i.e. http://xxx/webapp/ the filters are
ignored, but the welcome page is found correctly. What am I doing
wrong? Here is my web.xml

<filter>
<filter-name>Filter1</filter-name>
<filter-class>Filter1</filter-class>
</filter>
<filter-mapping>
<filter-name>Filter1</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>Filter2</filter-name>
<filter-class>Filter2</filter-class>
</filter>
<filter-mapping>
<filter-name>Filter2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>page.jsp</welcome-file>
</welcome-file-list>
+Pie Number of slices to send: Send
You're not doing anything wrong. If the URL doesn't match the pattern, the filter is not going to be called.

If you want to ensure that the filter is called for page.jsp, don't make it the 'welcome page'. Rather, make the welcome page an index.html file that redirects to page.jsp, thus ensuring that the filters will be invoked.
[ March 10, 2006: Message edited by: Bear Bibeault ]
+Pie Number of slices to send: Send
Thanks for replying. I assumed that the /* on the filter mapping would map everything, but it looks like that's not the case when no specific page is requested.
+Pie Number of slices to send: Send
Just found out that this is a bug with IBM Websphere Application Server 6.0.2 and is fixed in version 6.0.2.7. In case anyone has the same problem see http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg27006876#6027 Fix Pack 7
I will suppress my every urge. But not this shameless plug:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 772 times.
Similar Threads
Q: Filter on Page 668 and page 695
filter-mapping doubt??
order of filter mapping
Servlet Filter chain construction order
how to work on struts using eclipse?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:41:46.