464727 - Update Javadoc for Java 8 DocLint
+ Fixing javadoc in jetty-annotations
This commit is contained in:
parent
b58bbd906d
commit
cffeea3ed6
|
@ -58,8 +58,6 @@ import org.eclipse.jetty.webapp.WebDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for Annotations
|
* Configuration for Annotations
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class AnnotationConfiguration extends AbstractConfiguration
|
public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
{
|
{
|
||||||
|
@ -292,8 +290,7 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if "*" is one of the values.
|
* @return true if "*" is one of the values.
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public boolean hasWildcard()
|
public boolean hasWildcard()
|
||||||
{
|
{
|
||||||
|
@ -301,8 +298,7 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the index of the "*" element, if it is specified. -1 otherwise.
|
* @return the index of the "*" element, if it is specified. -1 otherwise.
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public int getWildcardIndex()
|
public int getWildcardIndex()
|
||||||
{
|
{
|
||||||
|
@ -312,8 +308,7 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the ordering contains a single value of "*"
|
* @return true if the ordering contains a single value of "*"
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public boolean isDefaultOrder ()
|
public boolean isDefaultOrder ()
|
||||||
{
|
{
|
||||||
|
@ -322,8 +317,8 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the order index of the given classname
|
* Get the order index of the given classname
|
||||||
* @param name
|
* @param name the classname to look up
|
||||||
* @return
|
* @return the index of the class name (or -1 if not found)
|
||||||
*/
|
*/
|
||||||
public int getIndexOf (String name)
|
public int getIndexOf (String name)
|
||||||
{
|
{
|
||||||
|
@ -335,7 +330,7 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of elements of the ordering
|
* Get the number of elements of the ordering
|
||||||
* @return
|
* @return the size of the index
|
||||||
*/
|
*/
|
||||||
public int getSize()
|
public int getSize()
|
||||||
{
|
{
|
||||||
|
@ -498,8 +493,8 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Perform scanning of classes for annotations
|
* Perform scanning of classes for annotations
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context the context for the scan
|
||||||
* @throws Exception
|
* @throws Exception if unable to scan
|
||||||
*/
|
*/
|
||||||
protected void scanForAnnotations (WebAppContext context)
|
protected void scanForAnnotations (WebAppContext context)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -591,8 +586,9 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we should use multiple threads to scan for annotations or not
|
* Check if we should use multiple threads to scan for annotations or not
|
||||||
* @param context
|
* @param context the context of the multi threaded setting
|
||||||
* @return
|
* @return true if multi threading is enabled on the context, server, or via a System property.
|
||||||
|
* @see #MULTI_THREADED
|
||||||
*/
|
*/
|
||||||
protected boolean isUseMultiThreading(WebAppContext context)
|
protected boolean isUseMultiThreading(WebAppContext context)
|
||||||
{
|
{
|
||||||
|
@ -617,8 +613,9 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Work out how long we should wait for the async scanning to occur.
|
* Work out how long we should wait for the async scanning to occur.
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context the context of the max scan wait setting
|
||||||
* @return
|
* @return the max scan wait setting on the context, or server, or via a System property.
|
||||||
|
* @see #MAX_SCAN_WAIT
|
||||||
*/
|
*/
|
||||||
protected int getMaxScanWait (WebAppContext context)
|
protected int getMaxScanWait (WebAppContext context)
|
||||||
{
|
{
|
||||||
|
@ -638,8 +635,6 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
return Integer.getInteger(MAX_SCAN_WAIT, DEFAULT_MAX_SCAN_WAIT).intValue();
|
return Integer.getInteger(MAX_SCAN_WAIT, DEFAULT_MAX_SCAN_WAIT).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
|
* @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
|
||||||
*/
|
*/
|
||||||
|
@ -649,13 +644,6 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
context.getObjectFactory().addDecorator(new AnnotationDecorator(context));
|
context.getObjectFactory().addDecorator(new AnnotationDecorator(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param context
|
|
||||||
* @param scis
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void createServletContainerInitializerAnnotationHandlers (WebAppContext context, List<ServletContainerInitializer> scis)
|
public void createServletContainerInitializerAnnotationHandlers (WebAppContext context, List<ServletContainerInitializer> scis)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -723,7 +711,6 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
context.addBean(starter, true);
|
context.addBean(starter, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Resource getJarFor (ServletContainerInitializer service)
|
public Resource getJarFor (ServletContainerInitializer service)
|
||||||
throws MalformedURLException, IOException
|
throws MalformedURLException, IOException
|
||||||
{
|
{
|
||||||
|
@ -746,13 +733,15 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
return Resource.newResource(loadingJarName);
|
return Resource.newResource(loadingJarName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if the ServletContainerIntializer loaded via the ServiceLoader came
|
* Check to see if the ServletContainerIntializer loaded via the ServiceLoader came
|
||||||
* from a jar that is excluded by the fragment ordering. See ServletSpec 3.0 p.85.
|
* from a jar that is excluded by the fragment ordering. See ServletSpec 3.0 p.85.
|
||||||
* @param context
|
*
|
||||||
* @param sci
|
* @param context the context for the jars
|
||||||
|
* @param sci the servlet container initializer
|
||||||
|
* @param sciResource the resource for the servlet container initializer
|
||||||
* @return true if excluded
|
* @return true if excluded
|
||||||
|
* @throws Exception if unable to determine exclusion
|
||||||
*/
|
*/
|
||||||
public boolean isFromExcludedJar (WebAppContext context, ServletContainerInitializer sci, Resource sciResource)
|
public boolean isFromExcludedJar (WebAppContext context, ServletContainerInitializer sci, Resource sciResource)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -799,9 +788,9 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Test if the ServletContainerIntializer is excluded by the
|
* Test if the ServletContainerIntializer is excluded by the
|
||||||
* o.e.j.containerInitializerExclusionPattern
|
* o.e.j.containerInitializerExclusionPattern
|
||||||
* @param context
|
*
|
||||||
* @param sci
|
* @param sci the ServletContainerIntializer
|
||||||
* @return
|
* @return true if the ServletContainerIntializer is excluded
|
||||||
*/
|
*/
|
||||||
public boolean matchesExclusionPattern(ServletContainerInitializer sci)
|
public boolean matchesExclusionPattern(ServletContainerInitializer sci)
|
||||||
{
|
{
|
||||||
|
@ -818,9 +807,9 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Test if the ServletContainerInitializer is from the container classpath
|
* Test if the ServletContainerInitializer is from the container classpath
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context the context for the webapp classpath
|
||||||
* @param sci
|
* @param sci the ServletContainerIntializer
|
||||||
* @return
|
* @return true if ServletContainerIntializer is from container classpath
|
||||||
*/
|
*/
|
||||||
public boolean isFromContainerClassPath (WebAppContext context, ServletContainerInitializer sci)
|
public boolean isFromContainerClassPath (WebAppContext context, ServletContainerInitializer sci)
|
||||||
{
|
{
|
||||||
|
@ -829,11 +818,6 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
return sci.getClass().getClassLoader()==context.getClassLoader().getParent();
|
return sci.getClass().getClassLoader()==context.getClassLoader().getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param context
|
|
||||||
* @return list of non-excluded {@link ServletContainerInitializer}s
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public List<ServletContainerInitializer> getNonExcludedInitializers (WebAppContext context)
|
public List<ServletContainerInitializer> getNonExcludedInitializers (WebAppContext context)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -952,7 +936,8 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.
|
* Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.
|
||||||
*
|
*
|
||||||
* @return
|
* @param context the context for the initializer ordering configuration
|
||||||
|
* @return the ordering of the ServletContainerIntializer's
|
||||||
*/
|
*/
|
||||||
public ServletContainerInitializerOrdering getInitializerOrdering (WebAppContext context)
|
public ServletContainerInitializerOrdering getInitializerOrdering (WebAppContext context)
|
||||||
{
|
{
|
||||||
|
@ -970,9 +955,9 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Scan jars on container path.
|
* Scan jars on container path.
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context the context for the scan
|
||||||
* @param parser
|
* @param parser the parser to scan with
|
||||||
* @throws Exception
|
* @throws Exception if unable to scan
|
||||||
*/
|
*/
|
||||||
public void parseContainerPath (final WebAppContext context, final AnnotationParser parser) throws Exception
|
public void parseContainerPath (final WebAppContext context, final AnnotationParser parser) throws Exception
|
||||||
{
|
{
|
||||||
|
@ -1003,9 +988,9 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Scan jars in WEB-INF/lib
|
* Scan jars in WEB-INF/lib
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context the context for the scan
|
||||||
* @param parser
|
* @param parser the annotation parser to use
|
||||||
* @throws Exception
|
* @throws Exception if unable to scan and/or parse
|
||||||
*/
|
*/
|
||||||
public void parseWebInfLib (final WebAppContext context, final AnnotationParser parser) throws Exception
|
public void parseWebInfLib (final WebAppContext context, final AnnotationParser parser) throws Exception
|
||||||
{
|
{
|
||||||
|
@ -1066,9 +1051,9 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Scan classes in WEB-INF/classes
|
* Scan classes in WEB-INF/classes
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context the context for the scan
|
||||||
* @param parser
|
* @param parser the annotation parser to use
|
||||||
* @throws Exception
|
* @throws Exception if unable to scan and/or parse
|
||||||
*/
|
*/
|
||||||
public void parseWebInfClasses (final WebAppContext context, final AnnotationParser parser)
|
public void parseWebInfClasses (final WebAppContext context, final AnnotationParser parser)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -1099,10 +1084,10 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
||||||
/**
|
/**
|
||||||
* Get the web-fragment.xml from a jar
|
* Get the web-fragment.xml from a jar
|
||||||
*
|
*
|
||||||
* @param jar
|
* @param jar the jar to look in for a fragment
|
||||||
* @param frags
|
* @param frags the fragments previously found
|
||||||
* @return the fragment if found, or null of not found
|
* @return true if the fragment if found, or null of not found
|
||||||
* @throws Exception
|
* @throws Exception if unable to determine the the fragment contains
|
||||||
*/
|
*/
|
||||||
public FragmentDescriptor getFragmentFromJar (Resource jar, List<FragmentDescriptor> frags)
|
public FragmentDescriptor getFragmentFromJar (Resource jar, List<FragmentDescriptor> frags)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
|
|
@ -23,16 +23,11 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AnnotationDecorator
|
* AnnotationDecorator
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class AnnotationDecorator implements Decorator
|
public class AnnotationDecorator implements Decorator
|
||||||
{
|
{
|
||||||
protected AnnotationIntrospector _introspector = new AnnotationIntrospector();
|
protected AnnotationIntrospector _introspector = new AnnotationIntrospector();
|
||||||
|
|
||||||
/**
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
public AnnotationDecorator(WebAppContext context)
|
public AnnotationDecorator(WebAppContext context)
|
||||||
{
|
{
|
||||||
registerHandlers(context);
|
registerHandlers(context);
|
||||||
|
@ -53,13 +48,13 @@ public class AnnotationDecorator implements Decorator
|
||||||
/**
|
/**
|
||||||
* Look for annotations that can be discovered with introspection:
|
* Look for annotations that can be discovered with introspection:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> Resource
|
* <li> Resource </li>
|
||||||
* <li> Resources
|
* <li> Resources </li>
|
||||||
* <li> PostConstruct
|
* <li> PostConstruct </li>
|
||||||
* <li> PreDestroy
|
* <li> PreDestroy </li>
|
||||||
* <li> ServletSecurity?
|
* <li> ServletSecurity? </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param o
|
* @param o the object ot introspect
|
||||||
*/
|
*/
|
||||||
protected void introspect (Object o)
|
protected void introspect (Object o)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,18 +48,18 @@ import org.objectweb.asm.Opcodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AnnotationParser
|
* AnnotationParser
|
||||||
*
|
* <p>
|
||||||
* Use asm to scan classes for annotations. A SAX-style parsing is done.
|
* Use asm to scan classes for annotations. A SAX-style parsing is done.
|
||||||
* Handlers are registered which will be called back when various types of
|
* Handlers are registered which will be called back when various types of
|
||||||
* entity are encountered, eg a class, a method, a field.
|
* entity are encountered, eg a class, a method, a field.
|
||||||
*
|
* <p>
|
||||||
* Handlers are not called back in any particular order and are assumed
|
* Handlers are not called back in any particular order and are assumed
|
||||||
* to be order-independent.
|
* to be order-independent.
|
||||||
*
|
* <p>
|
||||||
* As a registered Handler will be called back for each annotation discovered
|
* As a registered Handler will be called back for each annotation discovered
|
||||||
* on a class, a method, a field, the Handler should test to see if the annotation
|
* on a class, a method, a field, the Handler should test to see if the annotation
|
||||||
* is one that it is interested in.
|
* is one that it is interested in.
|
||||||
*
|
* <p>
|
||||||
* For the servlet spec, we are only interested in annotations on classes, methods and fields,
|
* For the servlet spec, we are only interested in annotations on classes, methods and fields,
|
||||||
* so the callbacks for handling finding a class, a method a field are themselves
|
* so the callbacks for handling finding a class, a method a field are themselves
|
||||||
* not fully implemented.
|
* not fully implemented.
|
||||||
|
@ -76,8 +76,8 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Convert internal name to simple name
|
* Convert internal name to simple name
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name the internal name
|
||||||
* @return
|
* @return the simple name
|
||||||
*/
|
*/
|
||||||
public static String normalize (String name)
|
public static String normalize (String name)
|
||||||
{
|
{
|
||||||
|
@ -96,8 +96,8 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Convert internal names to simple names.
|
* Convert internal names to simple names.
|
||||||
*
|
*
|
||||||
* @param list
|
* @param list the list of internal names
|
||||||
* @return
|
* @return the list of simple names
|
||||||
*/
|
*/
|
||||||
public static String[] normalize (String[] list)
|
public static String[] normalize (String[] list)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,6 @@ public class AnnotationParser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler
|
* Handler
|
||||||
*
|
*
|
||||||
|
@ -307,13 +306,10 @@ public class AnnotationParser
|
||||||
public void handle (FieldInfo info, String annotationName);
|
public void handle (FieldInfo info, String annotationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractHandler
|
* AbstractHandler
|
||||||
*
|
*
|
||||||
* Convenience base class to provide no-ops for all Handler methods.
|
* Convenience base class to provide no-ops for all Handler methods.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static abstract class AbstractHandler implements Handler
|
public static abstract class AbstractHandler implements Handler
|
||||||
{
|
{
|
||||||
|
@ -533,7 +529,8 @@ public class AnnotationParser
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the class has already been processed, false otherwise
|
* True if the class has already been processed, false otherwise
|
||||||
* @param className
|
* @param className the classname
|
||||||
|
* @return true if class was parsed, false if not
|
||||||
*/
|
*/
|
||||||
public boolean isParsed (String className)
|
public boolean isParsed (String className)
|
||||||
{
|
{
|
||||||
|
@ -545,9 +542,10 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Parse a given class
|
* Parse a given class
|
||||||
*
|
*
|
||||||
* @param className
|
* @param handlers the set of handlers to find class
|
||||||
* @param resolver
|
* @param className the class name to parse
|
||||||
* @throws Exception
|
* @param resolver the class name resolver to use
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
public void parse (Set<? extends Handler> handlers, String className, ClassNameResolver resolver)
|
public void parse (Set<? extends Handler> handlers, String className, ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -575,10 +573,11 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Parse the given class, optionally walking its inheritance hierarchy
|
* Parse the given class, optionally walking its inheritance hierarchy
|
||||||
*
|
*
|
||||||
* @param clazz
|
* @param handlers the handlers to look for class in
|
||||||
* @param resolver
|
* @param clazz the class to look for
|
||||||
* @param visitSuperClasses
|
* @param resolver the resolver to look up class with
|
||||||
* @throws Exception
|
* @param visitSuperClasses if true, also visit super classes for parse
|
||||||
|
* @throws Exception if unable to parse class
|
||||||
*/
|
*/
|
||||||
public void parse (Set<? extends Handler> handlers, Class<?> clazz, ClassNameResolver resolver, boolean visitSuperClasses)
|
public void parse (Set<? extends Handler> handlers, Class<?> clazz, ClassNameResolver resolver, boolean visitSuperClasses)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -612,9 +611,10 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Parse the given classes
|
* Parse the given classes
|
||||||
*
|
*
|
||||||
* @param classNames
|
* @param handlers the set of handlers to look for class in
|
||||||
* @param resolver
|
* @param classNames the class name
|
||||||
* @throws Exception
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
public void parse (Set<? extends Handler> handlers, String[] classNames, ClassNameResolver resolver)
|
public void parse (Set<? extends Handler> handlers, String[] classNames, ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -629,9 +629,10 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Parse the given classes
|
* Parse the given classes
|
||||||
*
|
*
|
||||||
* @param classNames
|
* @param handlers the set of handlers to look for class in
|
||||||
* @param resolver
|
* @param classNames the class names
|
||||||
* @throws Exception
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
public void parse (Set<? extends Handler> handlers, List<String> classNames, ClassNameResolver resolver)
|
public void parse (Set<? extends Handler> handlers, List<String> classNames, ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -665,14 +666,15 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Parse all classes in a directory
|
* Parse all classes in a directory
|
||||||
*
|
*
|
||||||
* @param dir
|
* @param handlers the set of handlers to look for classes in
|
||||||
* @param resolver
|
* @param dir the resource directory to look for classes
|
||||||
* @throws Exception
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
protected void parseDir (Set<? extends Handler> handlers, Resource dir, ClassNameResolver resolver)
|
protected void parseDir (Set<? extends Handler> handlers, Resource dir, ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
//skip dirs whose name start with . (ie hidden)
|
// skip dirs whose name start with . (ie hidden)
|
||||||
if (!dir.isDirectory() || !dir.exists() || dir.getName().startsWith("."))
|
if (!dir.isDirectory() || !dir.exists() || dir.getName().startsWith("."))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -723,11 +725,12 @@ public class AnnotationParser
|
||||||
* Parse classes in the supplied classloader.
|
* Parse classes in the supplied classloader.
|
||||||
* Only class files in jar files will be scanned.
|
* Only class files in jar files will be scanned.
|
||||||
*
|
*
|
||||||
* @param loader
|
* @param handlers the handlers to look for classes in
|
||||||
* @param visitParents
|
* @param loader the classloader for the classes
|
||||||
* @param nullInclusive
|
* @param visitParents if true, visit parent classloaders too
|
||||||
* @param resolver
|
* @param nullInclusive if true, an empty pattern means all names match, if false, none match
|
||||||
* @throws Exception
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
public void parse (final Set<? extends Handler> handlers, ClassLoader loader, boolean visitParents, boolean nullInclusive, final ClassNameResolver resolver)
|
public void parse (final Set<? extends Handler> handlers, ClassLoader loader, boolean visitParents, boolean nullInclusive, final ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -765,9 +768,10 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Parse classes in the supplied uris.
|
* Parse classes in the supplied uris.
|
||||||
*
|
*
|
||||||
* @param uris
|
* @param handlers the handlers to look for classes in
|
||||||
* @param resolver
|
* @param uris the uris for the jars
|
||||||
* @throws Exception
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
public void parse (final Set<? extends Handler> handlers, final URI[] uris, final ClassNameResolver resolver)
|
public void parse (final Set<? extends Handler> handlers, final URI[] uris, final ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -793,9 +797,11 @@ public class AnnotationParser
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a particular uri
|
* Parse a particular uri
|
||||||
* @param uri
|
*
|
||||||
* @param resolver
|
* @param handlers the handlers to look for classes in
|
||||||
* @throws Exception
|
* @param uri the uri for the jar
|
||||||
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
public void parse (final Set<? extends Handler> handlers, URI uri, final ClassNameResolver resolver)
|
public void parse (final Set<? extends Handler> handlers, URI uri, final ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -809,9 +815,11 @@ public class AnnotationParser
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a resource
|
* Parse a resource
|
||||||
* @param r
|
*
|
||||||
* @param resolver
|
* @param handlers the handlers to look for classes in
|
||||||
* @throws Exception
|
* @param r the resource to parse
|
||||||
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
public void parse (final Set<? extends Handler> handlers, Resource r, final ClassNameResolver resolver)
|
public void parse (final Set<? extends Handler> handlers, Resource r, final ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -847,9 +855,10 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Parse a resource that is a jar file.
|
* Parse a resource that is a jar file.
|
||||||
*
|
*
|
||||||
* @param jarResource
|
* @param handlers the handlers to look for classes in
|
||||||
* @param resolver
|
* @param jarResource the jar resource to parse
|
||||||
* @throws Exception
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
protected void parseJar (Set<? extends Handler> handlers, Resource jarResource, final ClassNameResolver resolver)
|
protected void parseJar (Set<? extends Handler> handlers, Resource jarResource, final ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -925,10 +934,12 @@ public class AnnotationParser
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a single entry in a jar file
|
* Parse a single entry in a jar file
|
||||||
* @param jar
|
*
|
||||||
* @param entry
|
* @param handlers the handlers to look for classes in
|
||||||
* @param resolver
|
* @param jar the jar resource to parse
|
||||||
* @throws Exception
|
* @param entry the entry in the jar resource to parse
|
||||||
|
* @param resolver the class name resolver
|
||||||
|
* @throws Exception if unable to parse
|
||||||
*/
|
*/
|
||||||
protected void parseJarEntry (Set<? extends Handler> handlers, Resource jar, JarEntry entry, final ClassNameResolver resolver)
|
protected void parseJarEntry (Set<? extends Handler> handlers, Resource jar, JarEntry entry, final ClassNameResolver resolver)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -963,9 +974,10 @@ public class AnnotationParser
|
||||||
/**
|
/**
|
||||||
* Use ASM on a class
|
* Use ASM on a class
|
||||||
*
|
*
|
||||||
|
* @param handlers the handlers to look for classes in
|
||||||
* @param containingResource the dir or jar that the class is contained within, can be null if not known
|
* @param containingResource the dir or jar that the class is contained within, can be null if not known
|
||||||
* @param is
|
* @param is the input stream to parse
|
||||||
* @throws IOException
|
* @throws IOException if unable to parse
|
||||||
*/
|
*/
|
||||||
protected void scanClass (Set<? extends Handler> handlers, Resource containingResource, InputStream is)
|
protected void scanClass (Set<? extends Handler> handlers, Resource containingResource, InputStream is)
|
||||||
throws IOException
|
throws IOException
|
||||||
|
|
|
@ -25,7 +25,7 @@ public interface ClassNameResolver
|
||||||
/**
|
/**
|
||||||
* Based on the execution context, should the class represented
|
* Based on the execution context, should the class represented
|
||||||
* by "name" be excluded from consideration?
|
* by "name" be excluded from consideration?
|
||||||
* @param name
|
* @param name the name to test
|
||||||
* @return true if classname is excluded
|
* @return true if classname is excluded
|
||||||
*/
|
*/
|
||||||
public boolean isExcluded (String name);
|
public boolean isExcluded (String name);
|
||||||
|
@ -35,7 +35,7 @@ public interface ClassNameResolver
|
||||||
* Based on the execution context, if a duplicate class
|
* Based on the execution context, if a duplicate class
|
||||||
* represented by "name" is detected, should the existing
|
* represented by "name" is detected, should the existing
|
||||||
* one be overridden or not?
|
* one be overridden or not?
|
||||||
* @param name
|
* @param name the name to test
|
||||||
* @return true if name should be overridden
|
* @return true if name should be overridden
|
||||||
*/
|
*/
|
||||||
public boolean shouldOverride (String name);
|
public boolean shouldOverride (String name);
|
||||||
|
|
|
@ -27,17 +27,12 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DeclaresRolesAnnotationHandler
|
* DeclaresRolesAnnotationHandler
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DeclareRolesAnnotationHandler extends AbstractIntrospectableAnnotationHandler
|
public class DeclareRolesAnnotationHandler extends AbstractIntrospectableAnnotationHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
protected WebAppContext _context;
|
protected WebAppContext _context;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
public DeclareRolesAnnotationHandler(WebAppContext context)
|
public DeclareRolesAnnotationHandler(WebAppContext context)
|
||||||
{
|
{
|
||||||
super(false);
|
super(false);
|
||||||
|
|
|
@ -206,9 +206,12 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a Resource annotation on a Method.
|
* Process a Resource annotation on a Method.
|
||||||
*
|
* <p>
|
||||||
* This will generate a JNDI entry, and an Injection to be
|
* This will generate a JNDI entry, and an Injection to be
|
||||||
* processed when an instance of the class is created.
|
* processed when an instance of the class is created.
|
||||||
|
*
|
||||||
|
* @param clazz the class to process
|
||||||
|
* @param method the method to process
|
||||||
*/
|
*/
|
||||||
public void handleMethod(Class<?> clazz, Method method)
|
public void handleMethod(Class<?> clazz, Method method)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,9 +39,6 @@ public class ServletContainerInitializersStarter extends AbstractLifeCycle imple
|
||||||
private static final Logger LOG = Log.getLogger(ServletContainerInitializersStarter.class);
|
private static final Logger LOG = Log.getLogger(ServletContainerInitializersStarter.class);
|
||||||
WebAppContext _context;
|
WebAppContext _context;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
public ServletContainerInitializersStarter(WebAppContext context)
|
public ServletContainerInitializersStarter(WebAppContext context)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
@ -72,6 +69,4 @@ public class ServletContainerInitializersStarter extends AbstractLifeCycle imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,15 +40,15 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
/**
|
/**
|
||||||
* ServletSecurityAnnotationHandler
|
* ServletSecurityAnnotationHandler
|
||||||
*
|
*
|
||||||
* Inspect a class to see if it has an @ServletSecurity annotation on it,
|
* Inspect a class to see if it has an <code>@ServletSecurity</code> annotation on it,
|
||||||
* setting up the <security-constraint>s.
|
* setting up the <code><security-constraint>s</code>.
|
||||||
*
|
*
|
||||||
* A servlet can be defined in:
|
* A servlet can be defined in:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>web.xml
|
* <li>web.xml</li>
|
||||||
* <li>web-fragment.xml
|
* <li>web-fragment.xml</li>
|
||||||
* <li>@WebServlet annotation discovered
|
* <li>@WebServlet annotation discovered</li>
|
||||||
* <li>ServletContext.createServlet
|
* <li>ServletContext.createServlet</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* The ServletSecurity annotation for a servlet should only be processed
|
* The ServletSecurity annotation for a servlet should only be processed
|
||||||
|
@ -119,12 +119,14 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a jetty Constraint object, which represents the <auth-constraint> and
|
* Make a jetty Constraint object, which represents the <code><auth-constraint></code> and
|
||||||
* <user-data-constraint> elements, based on the security annotation.
|
* <code><user-data-constraint></code> elements, based on the security annotation.
|
||||||
* @param servlet
|
*
|
||||||
* @param rolesAllowed
|
* @param servlet the servlet
|
||||||
* @param permitOrDeny
|
* @param rolesAllowed the roles allowed
|
||||||
* @param transport
|
* @param permitOrDeny the role / permission semantic
|
||||||
|
* @param transport the transport guarantee
|
||||||
|
* @return the constraint
|
||||||
*/
|
*/
|
||||||
protected Constraint makeConstraint (Class servlet, String[] rolesAllowed, EmptyRoleSemantic permitOrDeny, TransportGuarantee transport)
|
protected Constraint makeConstraint (Class servlet, String[] rolesAllowed, EmptyRoleSemantic permitOrDeny, TransportGuarantee transport)
|
||||||
{
|
{
|
||||||
|
@ -135,7 +137,8 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ServletMappings for the servlet's class.
|
* Get the ServletMappings for the servlet's class.
|
||||||
* @param className
|
* @param className the class name
|
||||||
|
* @return the servlet mappings for the class
|
||||||
*/
|
*/
|
||||||
protected List<ServletMapping> getServletMappings(String className)
|
protected List<ServletMapping> getServletMappings(String className)
|
||||||
{
|
{
|
||||||
|
@ -154,9 +157,12 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there are already <security-constraint> elements defined that match the url-patterns for
|
* Check if there are already <code><security-constraint></code> elements defined that match the url-patterns for
|
||||||
* the servlet.
|
* the servlet.
|
||||||
* @param servletMappings
|
*
|
||||||
|
* @param servletMappings the servlet mappings
|
||||||
|
* @param constraintMappings the constraint mappings
|
||||||
|
* @return true if constraint exists
|
||||||
*/
|
*/
|
||||||
protected boolean constraintsExist (List<ServletMapping> servletMappings, List<ConstraintMapping> constraintMappings)
|
protected boolean constraintsExist (List<ServletMapping> servletMappings, List<ConstraintMapping> constraintMappings)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.jetty.util.TypeUtil;
|
||||||
import org.objectweb.asm.Type;
|
import org.objectweb.asm.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Util
|
* Annotation Processing Utilities
|
||||||
*/
|
*/
|
||||||
public class Util
|
public class Util
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ public class Util
|
||||||
/**
|
/**
|
||||||
* Check if the presented method belongs to a class that is one
|
* Check if the presented method belongs to a class that is one
|
||||||
* of the classes with which a servlet container should be concerned.
|
* of the classes with which a servlet container should be concerned.
|
||||||
* @param c
|
* @param c the class
|
||||||
* @return true if class is a type of one of the following:
|
* @return true if class is a type of one of the following:
|
||||||
* ({@link javax.servlet.Servlet},
|
* ({@link javax.servlet.Servlet},
|
||||||
* {@link javax.servlet.Filter},
|
* {@link javax.servlet.Filter},
|
||||||
|
|
|
@ -39,17 +39,11 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebFilterAnnotation
|
* WebFilterAnnotation
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class WebFilterAnnotation extends DiscoveredAnnotation
|
public class WebFilterAnnotation extends DiscoveredAnnotation
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(WebFilterAnnotation.class);
|
private static final Logger LOG = Log.getLogger(WebFilterAnnotation.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* @param context
|
|
||||||
* @param className
|
|
||||||
*/
|
|
||||||
public WebFilterAnnotation(WebAppContext context, String className)
|
public WebFilterAnnotation(WebAppContext context, String className)
|
||||||
{
|
{
|
||||||
super(context, className);
|
super(context, className);
|
||||||
|
|
|
@ -40,17 +40,11 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebListenerAnnotation
|
* WebListenerAnnotation
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class WebListenerAnnotation extends DiscoveredAnnotation
|
public class WebListenerAnnotation extends DiscoveredAnnotation
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(WebListenerAnnotation.class);
|
private static final Logger LOG = Log.getLogger(WebListenerAnnotation.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* @param context
|
|
||||||
* @param className
|
|
||||||
*/
|
|
||||||
public WebListenerAnnotation(WebAppContext context, String className)
|
public WebListenerAnnotation(WebAppContext context, String className)
|
||||||
{
|
{
|
||||||
super(context, className);
|
super(context, className);
|
||||||
|
|
|
@ -34,10 +34,6 @@ public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotation
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(ClassInfo, String)
|
|
||||||
*/
|
|
||||||
public void handle(ClassInfo info, String annotationName)
|
public void handle(ClassInfo info, String annotationName)
|
||||||
{
|
{
|
||||||
if (annotationName == null || !"javax.servlet.annotation.WebListener".equals(annotationName))
|
if (annotationName == null || !"javax.servlet.annotation.WebListener".equals(annotationName))
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
* WebServletAnnotationHandler
|
* WebServletAnnotationHandler
|
||||||
*
|
*
|
||||||
* Process a WebServlet annotation on a class.
|
* Process a WebServlet annotation on a class.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class WebServletAnnotationHandler extends AbstractDiscoverableAnnotationHandler
|
public class WebServletAnnotationHandler extends AbstractDiscoverableAnnotationHandler
|
||||||
{
|
{
|
||||||
|
@ -43,8 +42,6 @@ public class WebServletAnnotationHandler extends AbstractDiscoverableAnnotationH
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle discovering a WebServlet annotation.
|
* Handle discovering a WebServlet annotation.
|
||||||
*
|
|
||||||
* @see org.eclipse.jetty.annotations.AnnotationParser.Handler#handle(ClassInfo, String)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void handle(ClassInfo info, String annotationName)
|
public void handle(ClassInfo info, String annotationName)
|
||||||
|
|
Loading…
Reference in New Issue