org.apache.tomcat.util.bcel.classfile.JavaClass Java Examples

The following examples show how to use org.apache.tomcat.util.bcel.classfile.JavaClass. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextConfig.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
protected void processClass(WebXml fragment, JavaClass clazz) {
    AnnotationEntry[] annotationsEntries = clazz.getAnnotationEntries();
    if (annotationsEntries != null) {
        String className = clazz.getClassName();
        for (AnnotationEntry ae : annotationsEntries) {
            String type = ae.getAnnotationType();
            if ("Ljavax/servlet/annotation/WebServlet;".equals(type)) {
                processAnnotationWebServlet(className, ae, fragment);
            }else if ("Ljavax/servlet/annotation/WebFilter;".equals(type)) {
                processAnnotationWebFilter(className, ae, fragment);
            }else if ("Ljavax/servlet/annotation/WebListener;".equals(type)) {
                fragment.addListener(className);
            } else {
                // Unknown annotation - ignore
            }
        }
    }
}
 
Example #2
Source File: ContextConfig.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
protected void processAnnotationsStream(InputStream is, WebXml fragment,
        boolean handlesTypesOnly, Map<String,JavaClassCacheEntry> javaClassCache)
        throws ClassFormatException, IOException {

    ClassParser parser = new ClassParser(is);
    JavaClass clazz = parser.parse();
    checkHandlesTypes(clazz, javaClassCache);

    if (handlesTypesOnly) {
        return;
    }

    processClass(fragment, clazz);
}
 
Example #3
Source File: ContextConfig.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private void populateJavaClassCache(String className, JavaClass javaClass,
        Map<String,JavaClassCacheEntry> javaClassCache) {
    if (javaClassCache.containsKey(className)) {
        return;
    }

    // Add this class to the cache
    javaClassCache.put(className, new JavaClassCacheEntry(javaClass));

    populateJavaClassCache(javaClass.getSuperclassName(), javaClassCache);

    for (String interfaceName : javaClass.getInterfaceNames()) {
        populateJavaClassCache(interfaceName, javaClassCache);
    }
}
 
Example #4
Source File: ContextConfig.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
protected void processAnnotationsStream(InputStream is, WebXml fragment,
        boolean handlesTypesOnly)
        throws ClassFormatException, IOException {

    ClassParser parser = new ClassParser(is);
    JavaClass clazz = parser.parse();
    checkHandlesTypes(clazz);

    if (handlesTypesOnly) {
        return;
    }

    String className = clazz.getClassName();

    AnnotationEntry[] annotationsEntries = clazz.getAnnotationEntries();
    if (annotationsEntries != null) {
        for (AnnotationEntry ae : annotationsEntries) {
            String type = ae.getAnnotationType();
            if ("Ljavax/servlet/annotation/WebServlet;".equals(type)) {
                processAnnotationWebServlet(className, ae, fragment);
            }else if ("Ljavax/servlet/annotation/WebFilter;".equals(type)) {
                processAnnotationWebFilter(className, ae, fragment);
            }else if ("Ljavax/servlet/annotation/WebListener;".equals(type)) {
                fragment.addListener(className);
            } else {
                // Unknown annotation - ignore
            }
        }
    }
}
 
Example #5
Source File: ContextConfig.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
private void populateJavaClassCache(String className, JavaClass javaClass) {
    if (javaClassCache.containsKey(className)) {
        return;
    }

    // Add this class to the cache
    javaClassCache.put(className, new JavaClassCacheEntry(javaClass));

    populateJavaClassCache(javaClass.getSuperclassName());

    for (String iterface : javaClass.getInterfaceNames()) {
        populateJavaClassCache(iterface);
    }
}
 
Example #6
Source File: ContextConfig.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public JavaClassCacheEntry(JavaClass javaClass) {
    superclassName = javaClass.getSuperclassName();
    interfaceNames = javaClass.getInterfaceNames();
}
 
Example #7
Source File: ContextConfig.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
public JavaClassCacheEntry(JavaClass javaClass) {
    superclassName = javaClass.getSuperclassName();
    interfaceNames = javaClass.getInterfaceNames();
}
 
Example #8
Source File: OpenEJBContextConfig.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
protected void checkHandlesTypes(final JavaClass javaClass,
                                 final Map<String,JavaClassCacheEntry> javaClassCache) {
    // no-op
}