• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Filters

 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


Is this statement right???

Filters are called in the order they appear in the deployment descriptor

i think this statement is false.Because depending up on request ,the container will check the DD and then it will find the url patterns and <servet-name> tags.If both are there then it will first go with <url-pattern> tag and then <servlet-name> tag.


AM i right???

source Marcus Green Mock Exams


Thanks

Anil Kumar
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anil kumar:
Hi


Is this statement right???

Filters are called in the order they appear in the deployment descriptor

i think this statement is false.Because depending up on request ,the container will check the DD and then it will find the url patterns and <servet-name> tags.If both are there then it will first go with <url-pattern> tag and then <servlet-name> tag.


AM i right???

source Marcus Green Mock Exams


Thanks

Anil Kumar


You're correct; first the filters for a url-pattern will be applied ( in their order of declaration if there are multiple filters that match a particular pattern ) and then, the filters for a servlet-name will be applied ( again, in order of declaration ).
 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

So, the statement is false.

Am i right??


Thanks for the clarification


Thanks

Anil Kumar
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anil kumar:
Hi

So, the statement is false.

Am i right??


Thanks for the clarification


Thanks

Anil Kumar


Well...it's correct to the extent that the final order for multiple filters depends on the declaration order. But it's incorrect because the order also depends on whether it was mapped to a url-pattern or a servlet-name.

I would say it depends on which other choices are available.
 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

This is the exact question.Now let me know.

Which of the following statements are true?

Choose at least one answer.
a. HttpServletResponseWrapper takes a constructor parameter of type HttpServletResponse Correct
b. Filters are called in the order they appear in the deployment descriptor Correct
c. Methods of the wrapper classes must not be overridden Incorrect
d. Filters are an example of the Intercepting Filter design patttern Correct
e. Filters can only be invoked on incoming requests, and not on a dispatcher forward or include



The answers are a,b,d.


I think option b is wrong.



Thanks

Anil Kumar
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anil kumar:
Hi

This is the exact question.Now let me know.

Which of the following statements are true?

Choose at least one answer.
a. HttpServletResponseWrapper takes a constructor parameter of type HttpServletResponse Correct
b. Filters are called in the order they appear in the deployment descriptor Correct
c. Methods of the wrapper classes must not be overridden Incorrect
d. Filters are an example of the Intercepting Filter design patttern Correct
e. Filters can only be invoked on incoming requests, and not on a dispatcher forward or include



The answers are a,b,d.


I think option b is wrong.



Thanks

Anil Kumar


I would mark it as correct; though I find it confusing and I'm not very sure.

Also, option e should also be correct; as of the specification version 2.4, filters can be applied to request dispatchers also.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tarun Yadav:
Also, option e should also be correct; as of the specification version 2.4, filters can be applied to request dispatchers also.

Are you sure you read option e correctly? It says quite the opposite.
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marc Peabody:

Are you sure you read option e correctly? It says quite the opposite.


Eep! Sorry! Dunno what I read. You're absolutely right, of course.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic