001: //========================================================================
002: //$Id: ServletHandler.java 1448 2006-12-29 20:46:57Z janb $
003: //Copyright 2006 Mort Bay Consulting Pty. Ltd.
004: //------------------------------------------------------------------------
005: //Licensed under the Apache License, Version 2.0 (the "License");
006: //you may not use this file except in compliance with the License.
007: //You may obtain a copy of the License at
008: //http://www.apache.org/licenses/LICENSE-2.0
009: //Unless required by applicable law or agreed to in writing, software
010: //distributed under the License is distributed on an "AS IS" BASIS,
011: //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: //See the License for the specific language governing permissions and
013: //limitations under the License.
014: //========================================================================
015:
016: package org.mortbay.jetty.plus.servlet;
017:
018: import javax.servlet.Filter;
019: import javax.servlet.Servlet;
020:
021: import org.mortbay.jetty.plus.annotation.InjectionCollection;
022: import org.mortbay.jetty.plus.annotation.LifeCycleCallbackCollection;
023:
024: /**
025: * ServletHandler
026: *
027: *
028: */
029: public class ServletHandler extends
030: org.mortbay.jetty.servlet.ServletHandler {
031:
032: private InjectionCollection _injections = null;
033: private LifeCycleCallbackCollection _callbacks = null;
034:
035: /**
036: * @return the callbacks
037: */
038: public LifeCycleCallbackCollection getCallbacks() {
039: return _callbacks;
040: }
041:
042: /**
043: * @param callbacks the callbacks to set
044: */
045: public void setCallbacks(LifeCycleCallbackCollection callbacks) {
046: this ._callbacks = callbacks;
047: }
048:
049: /**
050: * @return the injections
051: */
052: public InjectionCollection getInjections() {
053: return _injections;
054: }
055:
056: /**
057: * @param injections the injections to set
058: */
059: public void setInjections(InjectionCollection injections) {
060: this ._injections = injections;
061: }
062:
063: /**
064: * @see org.mortbay.jetty.servlet.ServletHandler#customizeFilter(javax.servlet.Filter)
065: */
066: public Filter customizeFilter(Filter filter) throws Exception {
067: if (_injections != null)
068: _injections.inject(filter);
069:
070: if (_callbacks != null)
071: _callbacks.callPostConstructCallback(filter);
072: return super .customizeFilter(filter);
073: }
074:
075: /**
076: * @see org.mortbay.jetty.servlet.ServletHandler#customizeServlet(javax.servlet.Servlet)
077: */
078: public Servlet customizeServlet(Servlet servlet) throws Exception {
079: if (_injections != null)
080: _injections.inject(servlet);
081: if (_callbacks != null)
082: _callbacks.callPostConstructCallback(servlet);
083: return super .customizeServlet(servlet);
084: }
085:
086: /**
087: * @see org.mortbay.jetty.servlet.ServletHandler#cusomizeFilterDestroy(javax.servlet.Filter)
088: */
089: public Filter customizeFilterDestroy(Filter filter)
090: throws Exception {
091: if (_callbacks != null)
092: _callbacks.callPreDestroyCallback(filter);
093: return super .customizeFilterDestroy(filter);
094: }
095:
096: /**
097: * @see org.mortbay.jetty.servlet.ServletHandler#customizeServletDestroy(javax.servlet.Servlet)
098: */
099: public Servlet customizeServletDestroy(Servlet servlet)
100: throws Exception {
101: if (_callbacks != null)
102: _callbacks.callPreDestroyCallback(servlet);
103: return super.customizeServletDestroy(servlet);
104: }
105: }
|