This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes doFilter - what to do in this case? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "doFilter - what to do in this case?" Watch "doFilter - what to do in this case?" New topic
Author

doFilter - what to do in this case?

Vinnie Jenks
Ranch Hand

Joined: Apr 26, 2004
Posts: 207
I'm trying to use (or so I thought) the doFilter method...maybe.

I'm using Hibernate (but this is *not* a Hibernate question!) and I'm trying to test an example in the Hibernate in Action book where the author uses doFilter to end sessions in a layered application.

I declared it like so:



Obviously, this is not being overridden and I need to do more to use this method "automatically".

What am I doing wrong here?

Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Did you declare it in the web.xml?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vinnie Jenks
Ranch Hand

Joined: Apr 26, 2004
Posts: 207
Originally posted by Bear Bibeault:
Did you declare it in the web.xml?


Nope, I guess I'm not sure how this is done exactly...couldn't find a real simple, clear example.

I've found some info on making a "servlet filter" which just appears to be a servlet...but the servlet I made is just a plain ol' servlet...and I was under the impression that I could use the doFilter in a plain servlet like mine?

Thanks again!
Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
Some of these links may help:
http://forum.hibernate.org/viewtopic.php?t=944255&sid=d43d8afc3b838595a2f8d416a03f6a18
http://www.onjava.com/pub/a/onjava/2001/05/10/servlet_filters.html?page=3
http://www.informit.com/guides/content.asp?g=java&seqNum=122&rl=1

Note sure though... Worth a look!
Vinnie Jenks
Ranch Hand

Joined: Apr 26, 2004
Posts: 207
Thanks for the links, I'll read up a little more.

Here's what I did that *appears* to work (everything runs, just not sure yet what doFilter is doing, entirely).



As you can see, I implemented the Filter interface and overrode the doFilter method...I didn't do anything to web.xml to reflect this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doFilter - what to do in this case?
 
Similar Threads
Question about servlet filters
Why does it take 2 requests to set session attribute?
org.apache.jasper.JasperException: java.util.ConcurrentModificationException
monitoring sql's using JAMon
Filtering Question