Forums Register Login

filter objects

+Pie Number of slices to send: Send
hi guys

is filter objects are created for every new request

or created once for every new session

is their any way to control or it should create for every new request

or for every new session

looking for your replies
+Pie Number of slices to send: Send
Maybe this article will help you with your questions

Filters
+Pie Number of slices to send: Send
Filters are just a compliment to Servlet. You can take it as a special kind of servlet that can transform a request or modify a response.

An Excerpt from the link given above:
They don't actually create a response. They are preprocessors of the request before it reaches a servlet, and/or postprocessors of the response leaving a servlet.
+Pie Number of slices to send: Send
thanks
Remko Strating and Adeel Ansari for your response

i didnt found answere to my question in your response
what iam asking is How the instances of the Filter are maintained
in the web server


in struts action-servlet instance is only once created

similar to action servlet filter objects are created once or created new for
every new request or created for every new session
+Pie Number of slices to send: Send
Adeel's answer covered it.
A Filter's life cycle is like a servlet's
For more information read section SRV.6.2.1 in the servlet specification:


SRV.6.2.1 Filter Lifecycle
After deployment of the Web application, and before a request causes the container
to access a Web resource, the container must locate the list of filters that must be
applied to the Web resource as described below. The container must ensure that it
has instantiated a filter of the appropriate class for each filter in the list, and called its
init(FilterConfig config) method. The filter may throw an exception to indicate
that it cannot function properly. If the exception is of type UnavailableException,
the container may examine the isPermanent attribute of the exception and may
choose to retry the filter at some later time.
Only one instance per <filter> declaration in the deployment descriptor is
instantiated per Java Virtual Machine (JVMTM) of the container. The container

provides the filter config as declared in the filter�s deployment descriptor, the
reference to the ServletContext for the Web application, and the set of
initialization parameters.




 
+Pie Number of slices to send: Send
thanks for correcting me ben
I brought this back from the farm where they grow the tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 748 times.
Similar Threads
New instance or mutithreading
hibernate session
request Attribute vs session attribute
Slap me silly, but...
Back button
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 10:04:24.