Class Attachment

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<Page>, Attachment, Page
    Direct Known Subclasses:
    DynamicAttachment

    public class Attachment
    extends WikiPage
    implements Attachment
    Describes an attachment. Attachments are actually derivatives of a WikiPage, since they do actually have a WikiName as well.
    • Constructor Detail

      • Attachment

        public Attachment​(Engine engine,
                          java.lang.String parentPage,
                          java.lang.String fileName)
        Creates a new attachment. The final name of the attachment will be a synthesis of the parent page name and the file name.
        Parameters:
        engine - The Engine which is hosting this attachment.
        parentPage - The page which will contain this attachment.
        fileName - The file name for the attachment.
      • Attachment

        @Deprecated
        public Attachment​(WikiEngine engine,
                          java.lang.String parentPage,
                          java.lang.String fileName)
        Deprecated.
        kept for compatibility with page/attachment providers not using public API. Use Attachment(Engine, String, String) instead.
        Creates a new attachment. The final name of the attachment will be a synthesis of the parent page name and the file name.
        Parameters:
        engine - The Engine which is hosting this attachment.
        parentPage - The page which will contain this attachment.
        fileName - The file name for the attachment.
    • Method Detail

      • toString

        public java.lang.String toString()
        Returns a human-readable, only-debugging-suitable description.
        Overrides:
        toString in class WikiPage
        Returns:
        A debugging string
      • getFileName

        public java.lang.String getFileName()
        Returns the file name of the attachment.
        Specified by:
        getFileName in interface Attachment
        Returns:
        A String with the file name.
      • setFileName

        public void setFileName​(java.lang.String name)
        Sets the file name of this attachment.
        Specified by:
        setFileName in interface Attachment
        Parameters:
        name - The name of the attachment. Must be a legal file name without the path.
      • getParentName

        public java.lang.String getParentName()
        Returns the name of the parent of this Attachment, i.e. the page which contains this attachment.
        Specified by:
        getParentName in interface Attachment
        Returns:
        String depicting the parent of the attachment.
      • isCacheable

        public boolean isCacheable()
        Returns true, if this attachment can be cached by the user agent. By default attachments are cacheable.
        Specified by:
        isCacheable in interface Attachment
        Returns:
        False, if the attachment should not be cached by the user agent.
        Since:
        2.5.34
      • setCacheable

        public void setCacheable​(boolean value)
        Sets this attachment to be cacheable or not. This mostly concerns things like DynamicAttachments, but it may be useful for certain AttachmentProviders as well.
        Specified by:
        setCacheable in interface Attachment
        Parameters:
        value - True or false, depending on whether you want this attachment to be cacheable or not.
        Since:
        2.5.34