Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

web.xml question  RSS feed

 
nancy cochran
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
nancy cochran
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
nancy cochran
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!