aspose file tools*
The moose likes Servlets and the fly likes creatin  plugin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "creatin  plugin" Watch "creatin  plugin" New topic
Author

creatin plugin

arun krishnamurthy
Greenhorn

Joined: Aug 30, 2006
Posts: 6
How to create plugin.
For example if i want to store some data into Context Opject before any request comes,ie during servlet instantiataion, how can we do that?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61198
    
  66

That's not what I would term a "plugin".

But the answer to your question is to use a context listener that will execute when the web app starts prior to any requests being serviced.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

The question always arises: how can I make sure something happens as soon as I load a web module; or how can I initialize something as soon as an HttpSession is created. The solution is to use a lifcyle listner, such as an HttpSessionListener or a WebContextListener.

Here's a tutorial on how to create a web context listener, and an HttpSesionListener:

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

The code for one of these things looks something like this:



Of course, you have to edit the old web.xml file too, don't forget!

Cheers!

-Cameron McKenzie
arun krishnamurthy
Greenhorn

Joined: Aug 30, 2006
Posts: 6
Thanks Cameron
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creatin plugin