View Javadoc

    1   //========================================================================
    2   //$Id: Configuration.java 3680 2008-09-21 10:37:13Z janb $
    3   //Copyright 2006 Mort Bay Consulting Pty. Ltd.
    4   //------------------------------------------------------------------------
    5   //Licensed under the Apache License, Version 2.0 (the "License");
    6   //you may not use this file except in compliance with the License.
    7   //You may obtain a copy of the License at
    8   //http://www.apache.org/licenses/LICENSE-2.0
    9   //Unless required by applicable law or agreed to in writing, software
    10  //distributed under the License is distributed on an "AS IS" BASIS,
    11  //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //See the License for the specific language governing permissions and
    13  //limitations under the License.
    14  //========================================================================
    15
    16  package org.mortbay.jetty.annotations;
    17
    18  import java.util.Iterator;
    19
    20
    21  import org.mortbay.jetty.servlet.FilterHolder;
    22  import org.mortbay.jetty.servlet.ServletHolder;
    23  import org.mortbay.util.LazyList;
    24
    25  /**
    26   * Configuration
    27   *
    28   *
    29   */
    30  public class Configuration extends org.mortbay.jetty.plus.webapp.Configuration
    31  {
    32
    33      public Configuration () throws ClassNotFoundException
    34      {
    35          super();
    36      }
    37
    38      /**
    39       * @see org.mortbay.jetty.plus.webapp.AbstractConfiguration#parseAnnotations()
    40       */
    41      public void parseAnnotations() throws Exception
    42      {
    43          //look thru _servlets
    44          Iterator itor = LazyList.iterator(_servlets);
    45          while (itor.hasNext())
    46          {
    47              ServletHolder holder = (ServletHolder)itor.next();
    48              Class servlet = getWebAppContext().loadClass(holder.getClassName());
    49              AnnotationParser.parseAnnotations(getWebAppContext(), servlet, _runAsCollection,  _injections, _callbacks);
    50          }
    51
    52          //look thru _filters
    53          itor = LazyList.iterator(_filters);
    54          while (itor.hasNext())
    55          {
    56              FilterHolder holder = (FilterHolder)itor.next();
    57              Class filter = getWebAppContext().loadClass(holder.getClassName());
    58              AnnotationParser.parseAnnotations(getWebAppContext(), filter, null, _injections, _callbacks);
    59          }
    60
    61          //look thru _listeners
    62          itor = LazyList.iterator(_listeners);
    63          while (itor.hasNext())
    64          {
    65              Object listener = itor.next();
    66              AnnotationParser.parseAnnotations(getWebAppContext(), listener.getClass(), null, _injections, _callbacks);
    67          }
    68      }
    69  }