Class ExternalJs

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class ExternalJs
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable
    The configuration of an external JS file to be embedded in the HTML. Leads to an inclusion via the "script" element.
    Version:
    $Revision$ $Date$
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ExternalJs()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String asScriptTag()  
      ExternalJs clone()
      Method clone.
      boolean equals​(java.lang.Object other)
      Method equals.
      java.lang.String getIntegrity()
      Get the integrity hash to use for the external JS file emitted in the "script" element's "integrity" attribute.
      java.lang.String getOtherAttributes()
      Get other attributes to include in the "script" element for this external JS file, in the form of a whitespace separated list of key=value pairs.
      java.lang.String getReferrerpolicy()
      Get the referrerpolicy attribute to use when requesting the external JS file.
      java.lang.String getURL()
      Get the URL to include via "script" element with its "src" attribute in the HTML.
      int hashCode()
      Method hashCode.
      void setIntegrity​(java.lang.String integrity)
      Set the integrity hash to use for the external JS file emitted in the "script" element's "integrity" attribute.
      void setOtherAttributes​(java.lang.String otherAttributes)
      Set other attributes to include in the "script" element for this external JS file, in the form of a whitespace separated list of key=value pairs.
      void setReferrerpolicy​(java.lang.String referrerpolicy)
      Set the referrerpolicy attribute to use when requesting the external JS file.
      void setURL​(java.lang.String URL)
      Set the URL to include via "script" element with its "src" attribute in the HTML.
      java.lang.String toString()
      Method toString.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ExternalJs

        public ExternalJs()
    • Method Detail

      • clone

        public ExternalJs clone()
        Method clone.
        Overrides:
        clone in class java.lang.Object
        Returns:
        ExternalJs
      • equals

        public boolean equals​(java.lang.Object other)
        Method equals.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - a other object.
        Returns:
        boolean
      • getIntegrity

        public java.lang.String getIntegrity()
        Get the integrity hash to use for the external JS file emitted in the "script" element's "integrity" attribute. Its semantics are described in https://www.w3.org/TR/sri-2/ and its usage is strongly recommended. Some example tools for calculating the value are outlined in https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Subresource_Integrity#tools_for_generating_sri_hashes.
        Returns:
        String
      • getOtherAttributes

        public java.lang.String getOtherAttributes()
        Get other attributes to include in the "script" element for this external JS file, in the form of a whitespace separated list of key=value pairs. The keys and values will be included as-is in the generated "script" element, without any validation.
        Returns:
        String
      • getReferrerpolicy

        public java.lang.String getReferrerpolicy()
        Get the referrerpolicy attribute to use when requesting the external JS file. Its semantics are described in https://www.w3.org/TR/referrer-policy/ and setting it to "no-referrer" prevents sharing unnecessary information with 3rd parties.
        Returns:
        String
      • getURL

        public java.lang.String getURL()
        Get the URL to include via "script" element with its "src" attribute in the HTML.
        Returns:
        String
      • hashCode

        public int hashCode()
        Method hashCode.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        int
      • setIntegrity

        public void setIntegrity​(java.lang.String integrity)
        Set the integrity hash to use for the external JS file emitted in the "script" element's "integrity" attribute. Its semantics are described in https://www.w3.org/TR/sri-2/ and its usage is strongly recommended. Some example tools for calculating the value are outlined in https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Subresource_Integrity#tools_for_generating_sri_hashes.
        Parameters:
        integrity - a integrity object.
      • setOtherAttributes

        public void setOtherAttributes​(java.lang.String otherAttributes)
        Set other attributes to include in the "script" element for this external JS file, in the form of a whitespace separated list of key=value pairs. The keys and values will be included as-is in the generated "script" element, without any validation.
        Parameters:
        otherAttributes - a otherAttributes object.
      • setReferrerpolicy

        public void setReferrerpolicy​(java.lang.String referrerpolicy)
        Set the referrerpolicy attribute to use when requesting the external JS file. Its semantics are described in https://www.w3.org/TR/referrer-policy/ and setting it to "no-referrer" prevents sharing unnecessary information with 3rd parties.
        Parameters:
        referrerpolicy - a referrerpolicy object.
      • setURL

        public void setURL​(java.lang.String URL)
        Set the URL to include via "script" element with its "src" attribute in the HTML.
        Parameters:
        URL - a URL object.
      • toString

        public java.lang.String toString()
        Method toString.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String
      • asScriptTag

        public java.lang.String asScriptTag()
        Returns:
        the "script" element to include in the HTML for this external JS file.