File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to deploy a ServletRequestListener to work only for specified Servlets?

 
Nigel Chou
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that DD only provides mechanism for Listeners to work for the whole application, instead of some specified Servlet. Am I right?
If it is true. I feel it is a flaw, since sometimes you may want you ServletRequestListener to work not on every request to all the Servlets in the application. It is inefficient.
 
sven studde
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I feel it is a flaw, since sometimes you may want you ServletRequestListener to work not on every request to all the Servlets in the application.

What about:

[ October 15, 2006: Message edited by: sven studde ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you trying to do with the listener?
Is is something that could be done with a filter?
 
Lijo Jacob
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ServletRequestListener is used to listen events on the request. There is no meaning in making it servlet specific. A request can be to any resource, need not be to a servlet.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
People are always curious as to how to get the various listeners working in a web application. I hear that complaint so often, that I put together a flash, multimedia tutorial to demonstrate just that:

http://www.technicalfacilitation.com/examscam/tf/get.php?link=web

This deals with HttpSessionListeners an WebContextListeners, but coding and configuring all of the various Servlet and JSP API listeners is pretty much the same.

Do make sure there is an entry in your web.xml file:



As far as the class goes, it just has to implement the appropriate listener interfaces:



Here's the ear, which contains a functional war file. It was put together using IBM's Rational Application Developer (IRAD), but the war has been tested and runs fine on tomcat.

http://www.technicalfacilitation.com/examscam/tf/vangogh/09lifecyclelisteners.ear

Cheers!

-Cameron McKenzie
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic