• Post Reply Bookmark Topic Watch Topic
  • New Topic

Way to monitor servlet filters in Websphere?  RSS feed

 
Penny Dole
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

In my app, I added a Servlet filter to protect it from cross site framing (sad thing is that this filter really does very little except adding X-FRAME-OPTIONS header...)
I added it to my web.xml file and it seems to be working in some cases but not others.
Does anyone know of a way to watch, log, monitor, or whatever, these filters in Websphere 8 so I can figure out what can be going wrong?

Thanks..
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any reason you can't add a println or debug statement to the filter?
 
Penny Dole
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A valid point you are making obviously. And I should give this a try.

However, I am afraid that my problems do not come something going wrong with the code of the filter, but with the very filter not being used/run/processed in some cases.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Penny Dole wrote:However, I am afraid that my problems do not come something going wrong with the code of the filter, but with the very filter not being used/run/processed in some cases.

I agree. A println would show that because you could see the filter is never entered.
 
Claude Moore
Ranch Hand
Posts: 877
8
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don'y you use a frontendcontroller / gateway approach ? You may define a servlet which receives all requests for your application, and forwards to second-line servlets all requestes after logging them and having set a custom-header value. Second level servlets may check for this custom header and refuse to fullfill any request that has no such header - so that only requests filtered by your "Gateway" servlet are considerated valid.


 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Claude Moore wrote:Why don'y you use a frontendcontroller / gateway approach ? You may define a servlet which receives all requests for your application, and forwards to second-line servlets all requestes after logging them and having set a custom-header value. Second level servlets may check for this custom header and refuse to fullfill any request that has no such header - so that only requests filtered by your "Gateway" servlet are considerated valid.




What you are descirbing sounds an awful lot like a servlet filter.

Except kludgier.

Servlet filters are actually pretty foolproof. As long as the incoming URL matches on the URL pattern filter-mapping, the filter WILL be invoked. So if the filter doesn't seem to get used, first try widening the URL mapping.

Beyond that, make sure that any exceptions that get thrown and intercepted within the filter don't get silently eaten (this is a capital offense if you pass code on to me!) In other words, if there's an exception caught, make sure it either gets re-thrown or it gets logged.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!