Class ClasspathResource
java.lang.Object
org.apache.xmlgraphics.util.ClasspathResource
A class to find resources in the classpath by their mime-type specified in
the MANIFEST.
This class searches for content entries in all META-INF/MANIFEST.MF files. It will find files with a given Content-Type: attribute. This allows to add arbitrary resources by content-type just by creating a JAR wrapper and adding them to the classpath.
Example:
Name: test.txt Content-Type: text/plain
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static ClasspathResourceprivate static final Stringprivate final MapActual Type: Map<String,List<URL>>.private static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddToMapping(String contentType, String name, ClassLoader classLoader) private Setstatic ClasspathResourceRetrieve the singleton instance of this class.listResourcesOfMimeType(String mimeType) Retrieve a list of resources known to have the given mime-type.private void
-
Field Details
-
contentMappings
Actual Type: Map<String,List<URL>>. -
MANIFEST_PATH
- See Also:
-
CONTENT_TYPE_KEY
- See Also:
-
classpathResource
-
-
Constructor Details
-
ClasspathResource
private ClasspathResource()
-
-
Method Details
-
getInstance
Retrieve the singleton instance of this class.- Returns:
- the ClassPathResource instance.
-
getClassLoadersForResources
-
loadManifests
private void loadManifests() -
addToMapping
-
listResourcesOfMimeType
-