• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Way to monitor servlet filters in Websphere?

 
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..
 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • 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
Posts: 40035
809
Eclipse IDE VI Editor Java
  • 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.
 
Bartender
Posts: 1268
39
IBM DB2 Netbeans IDE Spring Java
  • 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.


 
Saloon Keeper
Posts: 22270
151
Android Eclipse IDE Tomcat Server Redhat Java 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.
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic