Class ManifestAttributesReader

java.lang.Object
net.adoptopenjdk.icedteaweb.manifest.ManifestAttributesReader

public class ManifestAttributesReader extends Object
This class allows to read the security and configuration attributes specified in the JAR file manifest.
  • Field Details

  • Constructor Details

    • ManifestAttributesReader

      public ManifestAttributesReader(JNLPFile jnlpFile)
  • Method Details

    • setLoader

      public void setLoader(JNLPClassLoader loader)
    • isLoader

      public boolean isLoader()
    • getMainClass

      public String 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

      public String 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

      public String[] getEntryPoints()
      The fully qualified class names that can be used as entry point for the RIA.
      Returns:
      the Entry-Point class names
    • splitEntryPoints

      static String[] splitEntryPoints(String entryPointString)
    • getApplicationName

      public String 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

      public ClasspathMatcher.ClasspathMatchers 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

      public ClasspathMatcher.ClasspathMatchers 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

      public ClasspathMatcher.ClasspathMatchers 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

      public ManifestBoolean 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

      public ManifestBoolean 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

      public String 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

      private String getAttribute(String name)
      Get the manifest attribute value.
    • getAttribute

      public String getAttribute(Attributes.Name name)
      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

      private ManifestBoolean getBooleanAttribute(String name) throws IllegalArgumentException
      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 found
      jars - Jars that are checked to see if they contain the main class
      tracker - 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 find
      location - The JAR location
      tracker - resource tracker to use for the jar file lookup
      Returns:
      the attribute value, null if no attribute could be found for some reason
    • getMainClass

      public String 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.
      Parameters:
      location - The JAR location
      Returns:
      the main class name, null if there isn't one of if there was an error
    • getClassPaths

      public static Set<String> getClassPaths(Manifest manifest, URL originalJarPathLocation)
      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 manifest
      originalJarPathLocation - 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.