    001    /*****************************************************************************
    002     * Copyright (C) NanoContainer Organization. All rights reserved.            *
    003     * ------------------------------------------------------------------------- *
    004     * The software in this package is published under the terms of the BSD      *
    005     * style license a copy of which has been included with this distribution in *
    006     * the LICENSE.txt file.                                                     *
    007     *                                                                           *
    008     *****************************************************************************/
    009
    010    package org.nanocontainer.webcontainer;
    011
    012    import org.mortbay.jetty.servlet.FilterHolder;
    013    import org.mortbay.jetty.servlet.ServletHandler;
    014    import org.mortbay.jetty.servlet.ServletHolder;
    015    import org.picocontainer.PicoContainer;
    016
    017    public class PicoServletHandler extends ServletHandler {
    018
    019        private final PicoContainer parentContainer;
    020
    021        public PicoServletHandler(PicoContainer parentContainer) {
    022            this.parentContainer = parentContainer;
    023        }
    024
    025        public ServletHolder newServletHolder(Class servletClass) {
    026            return new PicoServletHolder(servletClass, parentContainer);
    027        }
    028
    029        public ServletHolder newServletHolder() {
    030            return new PicoServletHolder(parentContainer);
    031        }
    032
    033        public FilterHolder newFilterHolder(Class filterClass) {
    034            return new PicoFilterHolder(filterClass, parentContainer);
    035        }
    036
    037        public FilterHolder newFilterHolder() {
    038            return new PicoFilterHolder(parentContainer);
    039        }
    040    }