View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
4   //  ------------------------------------------------------------------------
5   //  All rights reserved. This program and the accompanying materials
6   //  are made available under the terms of the Eclipse Public License v1.0
7   //  and Apache License v2.0 which accompanies this distribution.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  package org.eclipse.jetty.annotations;
20  
21  import java.util.List;
22  
23  import org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler;
24  import org.eclipse.jetty.annotations.AnnotationParser.Value;
25  import org.eclipse.jetty.util.log.Log;
26  import org.eclipse.jetty.util.log.Logger;
27  import org.eclipse.jetty.webapp.DiscoveredAnnotation;
28  import org.eclipse.jetty.webapp.WebAppContext;
29  
30  /**
31   * WebFilterAnnotationHandler
32   *
33   *
34   */
35  public class WebFilterAnnotationHandler extends AbstractDiscoverableAnnotationHandler
36  {
37      private static final Logger LOG = Log.getLogger(WebFilterAnnotationHandler.class);
38  
39      public WebFilterAnnotationHandler (WebAppContext context)
40      {
41          super(context);
42      }
43      
44      public WebFilterAnnotationHandler (WebAppContext context, List<DiscoveredAnnotation> list)
45      {
46          super(context, list);
47      }
48      
49      public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation,
50                              List<Value> values)
51      {
52          WebFilterAnnotation wfAnnotation = new WebFilterAnnotation(_context, className, _resource);
53          addAnnotation(wfAnnotation);
54      }
55  
56      public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
57                              List<Value> values)
58      {
59          LOG.warn ("@WebFilter not applicable for fields: "+className+"."+fieldName);
60      }
61  
62      public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
63                               List<Value> values)
64      {
65          LOG.warn ("@WebFilter not applicable for methods: "+className+"."+methodName+" "+signature);
66      }
67  
68      @Override
69      public String getAnnotationName()
70      {
71          return "javax.servlet.annotation.WebFilter";
72      }
73  
74  }