Class ManifestAttributesReader
java.lang.Object
net.adoptopenjdk.icedteaweb.manifest.ManifestAttributesReader
This class allows to read the security and configuration attributes specified in the JAR file manifest.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe Application-Library-Allowable-Codebase attribute identifies the locations where your signed RIA is expected to be found.The Application-Name attribute is used in security prompts to provide a title for your signed RIA.private StringgetAttribute(String name) Get the manifest attribute value.getAttribute(Attributes.Name name) Returns the value of the specified manifest attribute name.static StringgetAttributeFromJar(Attributes.Name name, URL location, ResourceTracker tracker) Returns the value of the specified manifest attribute name, or null if the JAR referenced by the given location URL does not contain a manifest or the attribute could not not be found in the manifest.static StringgetAttributeFromJars(Attributes.Name name, List<JARDesc> jars, ResourceTracker tracker) Returns the value of the specified manifest attribute name.private ManifestBooleangetBooleanAttribute(String name) The Caller-Allowable-Codebase attribute is used to identify the domains from which JavaScript code can make calls to your RIA without security prompts.getClassPaths(Manifest manifest, URL originalJarPathLocation) Returns a set of paths that indicate the Class-Path entries in the manifest file.The Codebase attribute is used to restrict the code base of the JAR file to specific domains.getCodeBaseMatchersAttribute(String name, boolean includePath) The raw string representation (fully qualified class names separated by a space) of the Entry-Point manifest attribute value that can be used as entry point for the RIA.String[]The fully qualified class names that can be used as entry point for the RIA.main class can be defined outside of manifest.getMainClass(URL location, ResourceTracker resourceTracker) Gets the name of the main method as specified in the manifest used for launching applications packaged in JAR files.The Permissions attribute is used to verify that the permissions level requested by the RIA when it runs matches the permissions level that was set when the JAR file was created.booleanisLoader()The Trusted-Library attribute is used for applications and applets that are designed to allow untrusted components.The Trusted-Only attribute is used to prevent untrusted classes or resources from being loaded for an applet or application.voidsetLoader(JNLPClassLoader loader) (package private) static String[]splitEntryPoints(String entryPointString)
-
Field Details
-
LOG
-
jnlpFile
-
loader
-
-
Constructor Details
-
ManifestAttributesReader
-
-
Method Details
-
setLoader
-
isLoader
public boolean isLoader() -
getMainClass
main class can be defined outside of manifest. This method is mostly for completeness- Returns:
- main-class as it is specified in application
-
getEntryPoint
The raw string representation (fully qualified class names separated by a space) of the Entry-Point manifest attribute value that can be used as entry point for the RIA.- Returns:
- the Entry-Point manifest attribute value
- See Also:
-
getEntryPoints
The fully qualified class names that can be used as entry point for the RIA.- Returns:
- the Entry-Point class names
-
splitEntryPoints
-
getApplicationName
The Application-Name attribute is used in security prompts to provide a title for your signed RIA. Use of this attribute is recommended to help users make the decision to trust and run the RIA.- Returns:
- value of Application-Name manifest attribute
-
getCallerAllowableCodebase
The Caller-Allowable-Codebase attribute is used to identify the domains from which JavaScript code can make calls to your RIA without security prompts. Set this attribute to the domain that hosts the JavaScript code.- Returns:
- values of Caller-Allowable-Codebase manifest attribute
-
getApplicationLibraryAllowableCodebase
The Application-Library-Allowable-Codebase attribute identifies the locations where your signed RIA is expected to be found.- Returns:
- values of Application-Library-Allowable-Codebase manifest attribute
-
getCodebase
The Codebase attribute is used to restrict the code base of the JAR file to specific domains. Use this attribute to prevent someone from re-deploying your application on another website for malicious purposes.- Returns:
- values of Codebase manifest attribute
-
getCodeBaseMatchersAttribute
private ClasspathMatcher.ClasspathMatchers getCodeBaseMatchersAttribute(String name, boolean includePath) -
isTrustedOnly
The Trusted-Only attribute is used to prevent untrusted classes or resources from being loaded for an applet or application.- Returns:
- value of Trusted-Only manifest attribute
-
isTrustedLibrary
The Trusted-Library attribute is used for applications and applets that are designed to allow untrusted components.- Returns:
- value of Trusted-Library manifest attribute
-
getPermissions
The Permissions attribute is used to verify that the permissions level requested by the RIA when it runs matches the permissions level that was set when the JAR file was created.- Returns:
- value of Permissions manifest attribute
-
getAttribute
-
getAttribute
Returns the value of the specified manifest attribute name.- Parameters:
name- name of the manifest attribute to find in application- Returns:
- plain attribute value
-
getBooleanAttribute
- Throws:
IllegalArgumentException
-
getAttributeFromJars
public static String getAttributeFromJars(Attributes.Name name, List<JARDesc> jars, ResourceTracker tracker) Returns the value of the specified manifest attribute name. To do so, the given jar files are consulted in the following order: "main" jar in the given list, first jar in the given list, all jars in the given list.- Parameters:
name- attribute to be foundjars- Jars that are checked to see if they contain the main classtracker- tracker to use for the jar file lookup- Returns:
- the attribute value, null if no attribute could be found for some reason
-
getAttributeFromJar
public static String getAttributeFromJar(Attributes.Name name, URL location, ResourceTracker tracker) Returns the value of the specified manifest attribute name, or null if the JAR referenced by the given location URL does not contain a manifest or the attribute could not not be found in the manifest.- Parameters:
name- name of the attribute to findlocation- The JAR locationtracker- resource tracker to use for the jar file lookup- Returns:
- the attribute value, null if no attribute could be found for some reason
-
getMainClass
Gets the name of the main method as specified in the manifest used for launching applications packaged in JAR files.- Parameters:
location- The JAR location- Returns:
- the main class name, null if there isn't one of if there was an error
-
getClassPaths
Returns a set of paths that indicate the Class-Path entries in the manifest file. The paths are rooted in the same directory as the originalJarPath.- Parameters:
manifest- the manifestoriginalJarPathLocation- the remote/original path of the jar containing the manifest- Returns:
- a Set of String where each string is a path to the jar on the original jar's classpath.
-