permaculture playing cards*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Filters - could not understand Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Filters - could not understand" Watch "Filters - could not understand" New topic
Author

Filters - could not understand

Prem Vinodh
Ranch Hand

Joined: Mar 19, 2008
Posts: 33
Hi Ranchers,

This is my first post on Servlets and Jsp.
Planning to take my certification at the end of next month.

I was reading the Servlet 3.0 Specification on Filters.

The following extract has been taken from the Servlet 3.0 Speficiation
Among the types of functionality available to the developer needing to use filters are
the following:
■ The accessing of a resource before a request to it is invoked.


Could someone please explain what the above means
to access a resource before a request to it is invoked
?

I was of the assumption that we would modify the request, response or header data using filters.
The request before it reaches the resource or response after the call comes back from the resource
or the header information either before the request reaches the resource or when response is on its way back from the resource.

So I am a bit confused as to what the above sentence means.

Thanks in advance.
Prem Vinodh
Ranch Hand

Joined: Mar 19, 2008
Posts: 33
Hi Ranchers,

Is it that the container first checks whether the resource is present and if the resource is not present then it will not invoke the filter on the particular resource.
So for this the container first needs to check whether the resource is present.

So is this what is meant by the following statement
The accessing of a resource before a request to it is invoked.

Thanks in advance

gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

i think that suppose you have a resource(static or dynamic). to make it clear lets say the resource is a jar file or something. now with filter before you request this resource(jar file) you can access it using FilterConfig.getServletContext.getResource(String). the specs talk about resource so resource means any servlet, jsp, html .
Prem Vinodh
Ranch Hand

Joined: Mar 19, 2008
Posts: 33
Hi Sirji,

Thanks for the reply.
Ok now I see the actual meaning of it.

Thanks
Prem
 
jQuery in Action, 2nd edition
 
subject: Filters - could not understand