View Javadoc

1   // ========================================================================
2   // Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
3   // ------------------------------------------------------------------------
4   // All rights reserved. This program and the accompanying materials
5   // are made available under the terms of the Eclipse Public License v1.0
6   // and Apache License v2.0 which accompanies this distribution.
7   // The Eclipse Public License is available at 
8   // http://www.eclipse.org/legal/epl-v10.html
9   // The Apache License v2.0 is available at
10  // http://www.opensource.org/licenses/apache2.0.php
11  // You may elect to redistribute this code under either of these licenses. 
12  // ========================================================================
13  
14  package org.eclipse.jetty.servlet;
15  
16  import java.util.ArrayList;
17  import java.util.Arrays;
18  import java.util.Collections;
19  import java.util.EnumSet;
20  import java.util.EventListener;
21  import java.util.HashMap;
22  import java.util.HashSet;
23  import java.util.List;
24  import java.util.Map;
25  import java.util.Set;
26  
27  import javax.servlet.Filter;
28  import javax.servlet.RequestDispatcher;
29  import javax.servlet.Servlet;
30  import javax.servlet.ServletContext;
31  import javax.servlet.ServletContextEvent;
32  import javax.servlet.ServletContextListener;
33  import javax.servlet.ServletException;
34  
35  import org.eclipse.jetty.security.ConstraintAware;
36  import org.eclipse.jetty.security.ConstraintSecurityHandler;
37  import org.eclipse.jetty.security.SecurityHandler;
38  import org.eclipse.jetty.server.Dispatcher;
39  import org.eclipse.jetty.server.DispatcherType;
40  import org.eclipse.jetty.server.Handler;
41  import org.eclipse.jetty.server.HandlerContainer;
42  import org.eclipse.jetty.server.handler.ContextHandler;
43  import org.eclipse.jetty.server.handler.ErrorHandler;
44  import org.eclipse.jetty.server.handler.HandlerCollection;
45  import org.eclipse.jetty.server.handler.HandlerWrapper;
46  import org.eclipse.jetty.server.session.SessionHandler;
47  import org.eclipse.jetty.servlet.api.FilterRegistration;
48  import org.eclipse.jetty.servlet.api.ServletRegistration;
49  import org.eclipse.jetty.util.Loader;
50  
51  
52  /* ------------------------------------------------------------ */
53  /** Servlet Context.
54   * This extension to the ContextHandler allows for
55   * simple construction of a context with ServletHandler and optionally
56   * session and security handlers, et.<pre>
57   *   new ServletContext("/context",Context.SESSIONS|Context.NO_SECURITY);
58   * </pre>
59   * <p/>
60   * This class should have been called ServletContext, but this would have
61   * cause confusion with {@link ServletContext}.
62   */
63  public class ServletContextHandler extends ContextHandler
64  {   
65      public final static int SESSIONS=1;
66      public final static int SECURITY=2;
67      public final static int NO_SESSIONS=0;
68      public final static int NO_SECURITY=0;
69  
70      protected final List<Decorator> _decorators= new ArrayList<Decorator>();
71      protected Class<? extends SecurityHandler> _defaultSecurityHandlerClass=org.eclipse.jetty.security.ConstraintSecurityHandler.class;
72      protected SessionHandler _sessionHandler;
73      protected SecurityHandler _securityHandler;
74      protected ServletHandler _servletHandler;
75      protected int _options;
76      protected Object _restrictedContextListeners;
77      
78      /* ------------------------------------------------------------ */
79      public ServletContextHandler()
80      {
81          this(null,null,null,null,null);
82      }
83      
84      /* ------------------------------------------------------------ */
85      public ServletContextHandler(int options)
86      {
87          this(null,null,options);
88      }
89      
90      /* ------------------------------------------------------------ */
91      public ServletContextHandler(HandlerContainer parent, String contextPath)
92      {
93          this(parent,contextPath,null,null,null,null);
94      }
95      
96      /* ------------------------------------------------------------ */
97      public ServletContextHandler(HandlerContainer parent, String contextPath, int options)
98      {
99          this(parent,contextPath,null,null,null,null);
100         _options=options;
101     }
102     
103     /* ------------------------------------------------------------ */
104     public ServletContextHandler(HandlerContainer parent, String contextPath, boolean sessions, boolean security)
105     {
106         this(parent,contextPath,(sessions?SESSIONS:0)|(security?SECURITY:0));
107     }
108 
109     /* ------------------------------------------------------------ */
110     public ServletContextHandler(HandlerContainer parent, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
111     {   
112         this(parent,null,sessionHandler,securityHandler,servletHandler,errorHandler);
113     }
114 
115     /* ------------------------------------------------------------ */
116     public ServletContextHandler(HandlerContainer parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
117     {   
118         super((ContextHandler.Context)null);
119         _scontext = new Context();
120         _sessionHandler = sessionHandler;
121         _securityHandler = securityHandler;
122         _servletHandler = servletHandler;
123             
124         if (errorHandler!=null)
125             setErrorHandler(errorHandler);
126 
127         if (contextPath!=null)
128             setContextPath(contextPath);
129 
130         if (parent instanceof HandlerWrapper)
131             ((HandlerWrapper)parent).setHandler(this);
132         else if (parent instanceof HandlerCollection)
133             ((HandlerCollection)parent).addHandler(this);
134     }    
135 
136     /* ------------------------------------------------------------ */
137     /**
138      * @see org.eclipse.jetty.server.handler.ContextHandler#doStop()
139      */
140     @Override
141     protected void doStop() throws Exception
142     {
143         super.doStop();
144         _decorators.clear();
145     }
146 
147     /* ------------------------------------------------------------ */
148     /** Get the defaultSecurityHandlerClass.
149      * @return the defaultSecurityHandlerClass
150      */
151     public Class<? extends SecurityHandler> getDefaultSecurityHandlerClass()
152     {
153         return _defaultSecurityHandlerClass;
154     }
155 
156     /* ------------------------------------------------------------ */
157     /** Set the defaultSecurityHandlerClass.
158      * @param defaultSecurityHandlerClass the defaultSecurityHandlerClass to set
159      */
160     public void setDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass)
161     {
162         _defaultSecurityHandlerClass = defaultSecurityHandlerClass;
163     }
164 
165     /* ------------------------------------------------------------ */
166     protected SessionHandler newSessionHandler()
167     {
168         return new SessionHandler();
169     }
170     
171     /* ------------------------------------------------------------ */
172     protected SecurityHandler newSecurityHandler()
173     {
174         try
175         {
176             return (SecurityHandler)_defaultSecurityHandlerClass.newInstance();
177         }
178         catch(Exception e)
179         {
180             throw new IllegalStateException(e);
181         }
182     }
183 
184     /* ------------------------------------------------------------ */
185     protected ServletHandler newServletHandler()
186     {
187         return new ServletHandler();
188     }
189 
190     /* ------------------------------------------------------------ */
191     /**
192      * Finish constructing handlers and link them together.
193      * 
194      * @see org.eclipse.jetty.server.handler.ContextHandler#startContext()
195      */
196     protected void startContext() throws Exception
197     {
198         // force creation of missing handlers.
199         getSessionHandler();
200         getSecurityHandler();
201         getServletHandler();
202         
203         Handler handler = _servletHandler;
204         if (_securityHandler!=null)
205         {
206             _securityHandler.setHandler(handler);
207             handler=_securityHandler;
208         }
209         
210         if (_sessionHandler!=null)
211         {
212             _sessionHandler.setHandler(handler);
213             handler=_sessionHandler;
214         }
215         
216         // skip any wrapped handlers 
217         HandlerWrapper wrapper=this;
218         while (wrapper!=handler && wrapper.getHandler() instanceof HandlerWrapper)
219             wrapper=(HandlerWrapper)wrapper.getHandler();
220         
221         // if we are not already linked
222         if (wrapper!=handler)
223         {
224             if (wrapper.getHandler()!=null )
225                 throw new IllegalStateException("!ScopedHandler");
226             wrapper.setHandler(handler);
227         }
228         
229     	super.startContext();
230 
231     	// OK to Initialize servlet handler now
232     	if (_servletHandler != null && _servletHandler.isStarted())
233     	{
234     	    for (int i=_decorators.size()-1;i>=0; i--)
235     	    {
236     	        Decorator decorator = _decorators.get(i);
237                 if (_servletHandler.getFilters()!=null)
238                     for (FilterHolder holder:_servletHandler.getFilters())
239                         decorator.decorateFilterHolder(holder);
240     	        if(_servletHandler.getServlets()!=null)
241     	            for (ServletHolder holder:_servletHandler.getServlets())
242     	                decorator.decorateServletHolder(holder);
243     	    }   
244     	        
245     	    _servletHandler.initialize();
246     	}
247     }
248 
249     /* ------------------------------------------------------------ */
250     /**
251      * @return Returns the securityHandler.
252      */
253     public SecurityHandler getSecurityHandler()
254     {
255         if (_securityHandler==null && (_options&SECURITY)!=0 && !isStarted()) 
256             _securityHandler=newSecurityHandler();
257         
258         return _securityHandler;
259     }
260 
261     /* ------------------------------------------------------------ */
262     /**
263      * @return Returns the servletHandler.
264      */
265     public ServletHandler getServletHandler()
266     {
267         if (_servletHandler==null && !isStarted()) 
268             _servletHandler=newServletHandler();
269         return _servletHandler;
270     }
271 
272     /* ------------------------------------------------------------ */
273     /**
274      * @return Returns the sessionHandler.
275      */
276     public SessionHandler getSessionHandler()
277     {
278         if (_sessionHandler==null && (_options&SESSIONS)!=0 && !isStarted()) 
279             _sessionHandler=newSessionHandler();
280         return _sessionHandler;
281     }
282 
283     /* ------------------------------------------------------------ */
284     /** conveniance method to add a servlet.
285      */
286     public ServletHolder addServlet(String className,String pathSpec)
287     {
288         return getServletHandler().addServletWithMapping(className, pathSpec);
289     }
290 
291     /* ------------------------------------------------------------ */
292     /** conveniance method to add a servlet.
293      */
294     public ServletHolder addServlet(Class<? extends Servlet> servlet,String pathSpec)
295     {
296         return getServletHandler().addServletWithMapping(servlet.getName(), pathSpec);
297     }
298     
299     /* ------------------------------------------------------------ */
300     /** conveniance method to add a servlet.
301      */
302     public void addServlet(ServletHolder servlet,String pathSpec)
303     {
304         getServletHandler().addServletWithMapping(servlet, pathSpec);
305     }
306 
307     /* ------------------------------------------------------------ */
308     /** conveniance method to add a filter
309      */
310     public void addFilter(FilterHolder holder,String pathSpec,EnumSet<DispatcherType> dispatches)
311     {
312         getServletHandler().addFilterWithMapping(holder,pathSpec,dispatches);
313     }
314 
315     /* ------------------------------------------------------------ */
316     /** convenience method to add a filter
317      */
318     public FilterHolder addFilter(Class<? extends Filter> filterClass,String pathSpec,EnumSet<DispatcherType> dispatches)
319     {
320         return getServletHandler().addFilterWithMapping(filterClass,pathSpec,dispatches);
321     }
322 
323     /* ------------------------------------------------------------ */
324     /** convenience method to add a filter
325      */
326     public FilterHolder addFilter(String filterClass,String pathSpec,EnumSet<DispatcherType> dispatches)
327     {
328         return getServletHandler().addFilterWithMapping(filterClass,pathSpec,dispatches);
329     }
330     
331 
332     /* ------------------------------------------------------------ */
333     /** conveniance method to add a filter
334      */
335     public void addFilter(FilterHolder holder,String pathSpec,int dispatches)
336     {
337         getServletHandler().addFilterWithMapping(holder,pathSpec,dispatches);
338     }
339 
340     /* ------------------------------------------------------------ */
341     /** convenience method to add a filter
342      */
343     public FilterHolder addFilter(Class<? extends Filter> filterClass,String pathSpec,int dispatches)
344     {
345         return getServletHandler().addFilterWithMapping(filterClass,pathSpec,dispatches);
346     }
347 
348     /* ------------------------------------------------------------ */
349     /** convenience method to add a filter
350      */
351     public FilterHolder addFilter(String filterClass,String pathSpec,int dispatches)
352     {
353         return getServletHandler().addFilterWithMapping(filterClass,pathSpec,dispatches);
354     }
355 
356  
357 
358     public void callContextInitialized(ServletContextListener l, ServletContextEvent e)
359     {       
360         l.contextInitialized(e);  
361     }
362 
363 
364     public void callContextDestroyed(ServletContextListener l, ServletContextEvent e)
365     {
366         l.contextDestroyed(e);
367     }
368 
369 
370 
371     /* ------------------------------------------------------------ */
372     /**
373      * @param sessionHandler The sessionHandler to set.
374      */
375     public void setSessionHandler(SessionHandler sessionHandler)
376     {
377         if (isStarted())
378             throw new IllegalStateException("STARTED");
379         
380         _sessionHandler = sessionHandler;
381     }
382 
383     /* ------------------------------------------------------------ */
384     /**
385      * @param securityHandler The {@link SecurityHandler} to set on this context.
386      */
387     public void setSecurityHandler(SecurityHandler securityHandler)
388     {
389         if (isStarted())
390             throw new IllegalStateException("STARTED");
391         
392         _securityHandler = securityHandler;
393     }
394 
395     /* ------------------------------------------------------------ */
396     /**
397      * @param servletHandler The servletHandler to set.
398      */
399     public void setServletHandler(ServletHandler servletHandler)
400     {
401         if (isStarted())
402             throw new IllegalStateException("STARTED");
403         
404         _servletHandler = servletHandler;
405     }
406 
407     /* ------------------------------------------------------------ */
408     /**
409      * @return The decorator list used to resource inject new Filters, Servlets and EventListeners
410      */
411     public List<Decorator> getDecorators()
412     {
413         return Collections.unmodifiableList(_decorators);
414     }
415 
416     /* ------------------------------------------------------------ */
417     /**
418      * @param decorators The lis of {@link Decorator}s
419      */
420     public void setDecorators(List<Decorator> decorators)
421     {
422         _decorators.clear();
423         _decorators.addAll(decorators);
424     }
425     
426     /* ------------------------------------------------------------ */
427     /**
428      * @param decorator The decorator to add
429      */
430     public void addDecorator(Decorator decorator)
431     {
432         _decorators.add(decorator);
433     }
434 
435     /* ------------------------------------------------------------ */
436     void destroyServlet(Servlet servlet)
437     {
438         for (Decorator decorator : _decorators)
439             decorator.destroyServletInstance(servlet);
440     }
441 
442     /* ------------------------------------------------------------ */
443     void destroyFilter(Filter filter)
444     {
445         for (Decorator decorator : _decorators)
446             decorator.destroyFilterInstance(filter);
447     }
448     
449     /* ------------------------------------------------------------ */
450     public class Context extends ContextHandler.Context
451     {
452         /* ------------------------------------------------------------ */
453         /* 
454          * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
455          */
456         @Override
457         public RequestDispatcher getNamedDispatcher(String name)
458         {
459             ContextHandler context=org.eclipse.jetty.servlet.ServletContextHandler.this;
460             if (_servletHandler==null || _servletHandler.getServlet(name)==null)
461                 return null;
462             return new Dispatcher(context, name);
463         }
464         
465         /* ------------------------------------------------------------ */
466         /**
467          * @since servlet-api-3.0
468          */
469         public FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass)
470         {
471             if (isStarted())
472                 throw new IllegalStateException();
473 
474             final ServletHandler handler = ServletContextHandler.this.getServletHandler();
475             final FilterHolder holder= handler.newFilterHolder();
476             holder.setName(filterName);
477             holder.setHeldClass(filterClass);
478             handler.addFilter(holder);
479             return holder.getRegistration();
480         }
481 
482         /* ------------------------------------------------------------ */
483         /**
484          * @since servlet-api-3.0
485          */
486         public FilterRegistration.Dynamic addFilter(String filterName, String className)
487         {
488             if (isStarted())
489                 throw new IllegalStateException();
490 
491             final ServletHandler handler = ServletContextHandler.this.getServletHandler();
492             final FilterHolder holder= handler.newFilterHolder();
493             holder.setName(filterName);
494             holder.setClassName(className);
495             handler.addFilter(holder);
496             return holder.getRegistration();
497         }
498 
499 
500         /* ------------------------------------------------------------ */
501         /**
502          * @since servlet-api-3.0
503          */
504         public FilterRegistration.Dynamic addFilter(String filterName, Filter filter)
505         {
506             if (isStarted())
507                 throw new IllegalStateException();
508 
509             final ServletHandler handler = ServletContextHandler.this.getServletHandler();
510             final FilterHolder holder= handler.newFilterHolder();
511             holder.setName(filterName);
512             holder.setFilter(filter);
513             handler.addFilter(holder);
514             return holder.getRegistration();
515         }
516         
517         /* ------------------------------------------------------------ */
518         /**
519          * @since servlet-api-3.0
520          */
521         public ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass)
522         {
523             if (!isStarting())
524                 throw new IllegalStateException();
525 
526             final ServletHandler handler = ServletContextHandler.this.getServletHandler();
527             final ServletHolder holder= handler.newServletHolder();
528             holder.setName(servletName);
529             holder.setHeldClass(servletClass);
530             handler.addServlet(holder);
531             return holder.getRegistration();
532         }
533 
534         /* ------------------------------------------------------------ */
535         /**
536          * @since servlet-api-3.0
537          */
538         public ServletRegistration.Dynamic addServlet(String servletName, String className)
539         {
540             if (!isStarting())
541                 throw new IllegalStateException();
542             
543             final ServletHandler handler = ServletContextHandler.this.getServletHandler();
544             final ServletHolder holder= handler.newServletHolder();
545             holder.setName(servletName);
546             holder.setClassName(className);
547             handler.addServlet(holder);
548             return holder.getRegistration();
549         }
550 
551         /* ------------------------------------------------------------ */
552         /**
553          * @since servlet-api-3.0
554          */
555         public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet)
556         {
557             if (!isStarting())
558                 throw new IllegalStateException();
559 
560             final ServletHandler handler = ServletContextHandler.this.getServletHandler();
561             final ServletHolder holder= handler.newServletHolder();
562             holder.setName(servletName);
563             holder.setServlet(servlet);
564             handler.addServlet(holder);
565             return holder.getRegistration();
566         }
567 
568         /* ------------------------------------------------------------ */
569         public boolean setInitParameter(String name, String value)
570         {
571             // TODO other started conditions
572             if (!isStarting())
573                 throw new IllegalStateException();
574             
575             return super.setInitParameter(name,value);
576         }
577 
578         /* ------------------------------------------------------------ */
579         public <T extends Filter> T createFilter(Class<T> c) throws ServletException
580         {
581             try
582             {
583                 T f = c.newInstance();
584                 for (int i=_decorators.size()-1; i>=0; i--)
585                 {
586                     Decorator decorator = _decorators.get(i);
587                     f=decorator.decorateFilterInstance(f);
588                 }
589                 return f;
590             }
591             catch (InstantiationException e)
592             {
593                 throw new ServletException(e);
594             }
595             catch (IllegalAccessException e)
596             {
597                 throw new ServletException(e);
598             }
599         }
600 
601         /* ------------------------------------------------------------ */
602         public <T extends Servlet> T createServlet(Class<T> c) throws ServletException
603         {
604             try
605             {
606                 T s = c.newInstance();
607                 for (int i=_decorators.size()-1; i>=0; i--)
608                 {
609                     Decorator decorator = _decorators.get(i);
610                     s=decorator.decorateServletInstance(s);
611                 }
612                 return s;
613             }
614             catch (InstantiationException e)
615             {
616                 throw new ServletException(e);
617             }
618             catch (IllegalAccessException e)
619             {
620                 throw new ServletException(e);
621             }
622         }
623         
624         public FilterRegistration getFilterRegistration(String filterName)
625         {   
626             final FilterHolder holder=ServletContextHandler.this.getServletHandler().getFilter(filterName);
627             return (holder==null)?null:holder.getRegistration();
628         }
629 
630         
631         public Map<String, ? extends FilterRegistration> getFilterRegistrations()
632         {
633             HashMap<String, FilterRegistration> registrations = new HashMap<String, FilterRegistration>();
634             ServletHandler handler=ServletContextHandler.this.getServletHandler();
635             FilterHolder[] holders=handler.getFilters();
636             if (holders!=null)
637             {
638                 for (FilterHolder holder : holders)
639                     registrations.put(holder.getName(),holder.getRegistration());
640             }
641             return registrations;
642         }
643 
644         
645         public ServletRegistration getServletRegistration(String servletName)
646         { 
647             final ServletHolder holder=ServletContextHandler.this.getServletHandler().getServlet(servletName);
648             return (holder==null)?null:holder.getRegistration();
649         }
650 
651         
652         public Map<String, ? extends ServletRegistration> getServletRegistrations()
653         { 
654             HashMap<String, ServletRegistration> registrations = new HashMap<String, ServletRegistration>();
655             ServletHandler handler=ServletContextHandler.this.getServletHandler();
656             ServletHolder[] holders=handler.getServlets();
657             if (holders!=null)
658             {
659                 for (ServletHolder holder : holders)
660                     registrations.put(holder.getName(),holder.getRegistration());
661             }
662             return registrations;
663         }
664 
665   
666         public void addListener(String className)
667         {
668             // TODO other started conditions
669             if (!isStarting())
670                 throw new IllegalStateException();
671             try
672             {
673                 Class<? extends EventListener> clazz = getClassLoader()==null?Loader.loadClass(ContextHandler.class,className):getClassLoader().loadClass(className);
674                 addListener(clazz);
675             }
676             catch (ClassNotFoundException e)
677             {
678                 throw new IllegalArgumentException(e);
679             }
680         }
681 
682       
683         public <T extends EventListener> void addListener(T t)
684         {
685             if (!isStarting())
686                 throw new IllegalStateException();
687          
688             ServletContextHandler.this.addEventListener(t);
689         }
690 
691       
692         public void addListener(Class<? extends EventListener> listenerClass)
693         {
694             if (!isStarting())
695                 throw new IllegalStateException();
696 
697             try
698             {
699                 EventListener l = createListener(listenerClass);
700                 ServletContextHandler.this.addEventListener(l);
701             }
702             catch (ServletException e)
703             {
704                 throw new IllegalStateException(e);
705             }
706         }
707 
708    
709         public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException
710         {
711             try
712             {
713                 T l = null;
714                 try
715                 {
716                     l = clazz.newInstance();
717                 }
718                 catch (InstantiationException e)
719                 {
720                     throw new ServletException(e);
721                 }
722                 catch (IllegalAccessException e)
723                 {
724                     throw new ServletException(e);
725                 }
726 
727                 for (int i=_decorators.size()-1; i>=0; i--)
728                 {
729                     Decorator decorator = _decorators.get(i);
730                     l=decorator.decorateListenerInstance(l);
731                 }
732                 return l;
733             }
734             catch(ServletException e)
735             {
736                 throw e;
737             }
738             catch(Exception e)
739             {
740                 throw new ServletException(e);
741             }
742         }
743 
744      
745         public void declareRoles(String... roleNames)
746         {
747             if (!isStarting())
748                 throw new IllegalStateException();
749            
750             //Get a reference to the SecurityHandler, which must be ConstraintAware
751             if (_securityHandler != null && _securityHandler instanceof ConstraintAware)
752             {
753                 HashSet<String> union = new HashSet<String>();
754                 Set<String> existing = ((ConstraintAware)_securityHandler).getRoles();
755                 if (existing != null)
756                     union.addAll(existing);
757                 union.addAll(Arrays.asList(roleNames));
758                 ((ConstraintSecurityHandler)_securityHandler).setRoles(union);
759             }
760         }
761     }
762     
763     
764     /* ------------------------------------------------------------ */
765     /** Interface to decorate loaded classes.
766      */
767     public interface Decorator
768     {
769         <T extends Filter> T decorateFilterInstance(T filter) throws ServletException;
770         <T extends Servlet> T decorateServletInstance(T servlet) throws ServletException;
771         <T extends EventListener> T decorateListenerInstance(T listener) throws ServletException;
772 
773         void decorateFilterHolder(FilterHolder filter) throws ServletException;
774         void decorateServletHolder(ServletHolder servlet) throws ServletException;
775         
776         void destroyServletInstance(Servlet s);
777         void destroyFilterInstance(Filter f);
778         void destroyListenerInstance(EventListener f);
779     }
780 }