Class AppletDesc

  • All Implemented Interfaces:
    EntryPoint

    public class AppletDesc
    extends java.lang.Object
    implements EntryPoint
    The applet-desc element contains all information needed to launch an Applet, given the resources described by the resources elements. A JNLP file is an application descriptor for an Applet if the applet-desc element is specified.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String APPLET_DESC_ELEMENT  
      private java.net.URL documentBase
      The document base for the Applet as a URL.
      static java.lang.String DOCUMENTBASE_ATTRIBUTE  
      private int height
      Height of the Applet in pixels.
      static java.lang.String HEIGHT_ATTRIBUTE  
      private static Logger LOG  
      private java.lang.String mainClass
      This is the fully-qualified name of the main Applet class (e.g., com.mysite.MyApplet), as opposed to the HTML tag's code attribute as a filename (e.g., MyApplet.class).
      private java.lang.String name
      Name of the Applet.
      static java.lang.String NAME_ATTRIBUTE  
      static java.lang.String PARAM_ELEMENT  
      private java.util.Map<java.lang.String,​java.lang.String> parameters
      Contains parameters to the Applet.
      static java.lang.String PROGRESS_CLASS_ATTRIBUTE  
      private java.lang.String progressClass
      The name of a class containing an implementation of the DownloadServiceListener interface of applications.
      private int width
      Width of the Applet in pixels.
      static java.lang.String WIDTH_ATTRIBUTE  
    • Constructor Summary

      Constructors 
      Constructor Description
      AppletDesc​(java.lang.String name, java.lang.String mainClass, java.lang.String progressClass, java.net.URL documentBase, int width, int height, java.util.Map<java.lang.String,​java.lang.String> parameters)
      Create an Applet descriptor.
      AppletDesc​(java.lang.String name, java.lang.String mainClass, java.net.URL documentBase, int width, int height, java.util.Map<java.lang.String,​java.lang.String> parameters)
      Create an Applet descriptor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addParameter​(java.lang.String name, java.lang.String value)
      Adds a parameter to the Applet.
      private java.lang.String cleanMainClass()
      https://github.com/AdoptOpenJDK/IcedTea-Web/issues/361 appelts can have class specified both pkg.myclass and pkg.myclass.class There are several places in ITW where this can be applied I had decided to go eith direct getter from AppletDesc for several reasons: - it is applet-desc specific, and application-desc should not be crippeld by this - in checkForMain is palce where .class is appended, that would need to be adjsuted - checkEntryPoint is comparin main class against record in manifest.
      java.net.URL getDocumentBase()  
      int getHeight()  
      java.lang.String getMainClass()
      For Java applications this method returns the name of the class containing the public static void main(String[]) method.
      java.lang.String getName()  
      java.util.Map<java.lang.String,​java.lang.String> getParameters()  
      java.lang.String getProgressClass()
      The name of a class containing an implementation of the DownloadServiceListener interface.
      int getWidth()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final Logger LOG
      • APPLET_DESC_ELEMENT

        public static final java.lang.String APPLET_DESC_ELEMENT
        See Also:
        Constant Field Values
      • DOCUMENTBASE_ATTRIBUTE

        public static final java.lang.String DOCUMENTBASE_ATTRIBUTE
        See Also:
        Constant Field Values
      • HEIGHT_ATTRIBUTE

        public static final java.lang.String HEIGHT_ATTRIBUTE
        See Also:
        Constant Field Values
      • PROGRESS_CLASS_ATTRIBUTE

        public static final java.lang.String PROGRESS_CLASS_ATTRIBUTE
        See Also:
        Constant Field Values
      • name

        private final java.lang.String name
        Name of the Applet. This is available to the Applet through the AppletContext.
      • mainClass

        private final java.lang.String mainClass
        This is the fully-qualified name of the main Applet class (e.g., com.mysite.MyApplet), as opposed to the HTML tag's code attribute as a filename (e.g., MyApplet.class).
        • progressClass

          private final java.lang.String progressClass
          The name of a class containing an implementation of the DownloadServiceListener interface of applications. May be used to indicate download progress.
        • documentBase

          private final java.net.URL documentBase
          The document base for the Applet as a URL. This is available to the Applet through the AppletContext. The documentbase can be provided explicitly since an applet launched with a JNLP Client may not be embedded in a Web page.
        • width

          private final int width
          Width of the Applet in pixels.
        • height

          private final int height
          Height of the Applet in pixels.
        • parameters

          private final java.util.Map<java.lang.String,​java.lang.String> parameters
          Contains parameters to the Applet. The parameters can be retrieved with the Applet.getParameter method.
        • Constructor Detail

          • AppletDesc

            public AppletDesc​(java.lang.String name,
                              java.lang.String mainClass,
                              java.net.URL documentBase,
                              int width,
                              int height,
                              java.util.Map<java.lang.String,​java.lang.String> parameters)
            Create an Applet descriptor.
            Parameters:
            name - the applet name that is available to the Applet through the AppletContext
            mainClass - the fully-qualified name of the main Applet class
            documentBase - the document base for the Applet
            width - the width of the Applet in pixels
            height - the height of the Applet in pixels
            parameters - the parameters
          • AppletDesc

            public AppletDesc​(java.lang.String name,
                              java.lang.String mainClass,
                              java.lang.String progressClass,
                              java.net.URL documentBase,
                              int width,
                              int height,
                              java.util.Map<java.lang.String,​java.lang.String> parameters)
            Create an Applet descriptor.
            Parameters:
            name - the applet name that is available to the Applet through the AppletContext
            mainClass - the fully-qualified name of the main Applet class
            progressClass - the fully qualified name of the class containing an implementation of the DownloadServiceListener interface
            documentBase - the document base for the Applet
            width - the width of the Applet in pixels
            height - the height of the Applet in pixels
            parameters - the parameters
        • Method Detail

          • getName

            public java.lang.String getName()
            Returns:
            the applet name that is available to the Applet through the AppletContext
          • getMainClass

            public java.lang.String getMainClass()
            Description copied from interface: EntryPoint
            For Java applications this method returns the name of the class containing the public static void main(String[]) method. The name and/or meaning may vary as is appropriate for other types of applications.

            For Java this attribute can be omitted if the main class can be found from the Main-Class manifest entry in the main JAR file.

            Specified by:
            getMainClass in interface EntryPoint
            Returns:
            the fully-qualified name of the main Applet class
          • cleanMainClass

            private java.lang.String cleanMainClass()
            https://github.com/AdoptOpenJDK/IcedTea-Web/issues/361 appelts can have class specified both pkg.myclass and pkg.myclass.class There are several places in ITW where this can be applied I had decided to go eith direct getter from AppletDesc for several reasons: - it is applet-desc specific, and application-desc should not be crippeld by this - in checkForMain is palce where .class is appended, that would need to be adjsuted - checkEntryPoint is comparin main class against record in manifest. -- classes in manifest are supposed to be suffix .class free. Although you can smuggle class.class into manifest, that is usually bringing you toubles. -- eg. java -jar willnot load such main-class - I can be wrong with the manifest usage
            Returns:
            mainclass striped of tailing .class if any
          • getProgressClass

            public java.lang.String getProgressClass()
            The name of a class containing an implementation of the DownloadServiceListener interface.
            Returns:
            the fully qualified name of the class containing an implementation of the DownloadServiceListener interface
          • getDocumentBase

            public java.net.URL getDocumentBase()
            Returns:
            the document base for the Applet as a URL
          • getWidth

            public int getWidth()
            Returns:
            the width of the Applet in pixels
          • getHeight

            public int getHeight()
            Returns:
            the height of the Applet in pixels
          • getParameters

            public java.util.Map<java.lang.String,​java.lang.String> getParameters()
            Returns:
            the Applet parameters
          • addParameter

            public void addParameter​(java.lang.String name,
                                     java.lang.String value)
            Adds a parameter to the Applet. If the parameter already exists then it is overwritten with the new value. Adding a parameter will have no effect on already-running Applets launched from this JNLP file.
            Parameters:
            name - key of value
            value - value to be added