• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

filter objects  RSS feed

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 893
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this article will help you with your questions

Filters
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.




 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for correcting me ben
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!