Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FilterConfig object...

 
Alexandre Folgueras
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, I'm taking the exam next thursday and I am now doing my final revision. I have a question about Filters... I noticed that an init method that receives a FilterConfig object is required in a filter class... It says in the HF book that we use it to save the config object for later...

In the mock exam of the chapter, it says that Filters cannot reeive initialisation parameters like servlets do...

So my question is what is this filterConfig object for? What does it contain? How do you initialise it?

Your help will be greatly appreciated!

Alex
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Filter can receive initialization parameters by calling FilterConfig.getInitParameter(). You can specify the initialization parameters same as you specify it for servlets. One can get ServletContext object also.

Hope that helps.


Sawan
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!