Class ConfluenceRenderUtils


  • public final class ConfluenceRenderUtils
    extends Object
    Utilities for rendering Confluence wiki content.
    • Constructor Detail

      • ConfluenceRenderUtils

        public ConfluenceRenderUtils()
    • Method Detail

      • getAttachmentsRemotePath

        public static @Nullable String getAttachmentsRemotePath​(@Nullable PageContext context)
        Returns the remote path to files attached to the contextual page. The path commences with the application's context path.
        Parameters:
        context - must contain an existing ContentEntityObject
        Returns:
        null if context or its CEO is null, or else the path to the attachments of that ceo. Eg "/confluence/download/attachments/34253"
      • getAttachmentRemotePath

        public static @Nullable String getAttachmentRemotePath​(@Nullable Attachment attachment)
        Returns the remote path to the given attachment and its siblings. NOTE: this path does not include the attachment itself, just the path the attachment is located immediately within. The path commences with the application's context path.
        Parameters:
        attachment - must be attached to an existing ContentEntityObject
        Returns:
        null if attachment is null, or else the path to the attachments of the content to which the attachment belongs. Eg "/confluence/download/attachments/34253"
      • getAbsoluteAttachmentRemotePath

        public static @Nullable String getAbsoluteAttachmentRemotePath​(@Nullable Attachment attachment)
        Returns the remote path to the given attachment and its siblings. NOTE: this path does not include the attachment itself, just the path the attachment is located immediately within. The path commences with the application's base URL.
        Parameters:
        attachment - must be attached to an existing ContentEntityObject
        Returns:
        null if attachment is null, or else the path to the attachments of the content to which the attachment belongs. Eg "http://example.com/confluence/download/attachments/34253"
      • getAttachmentRemotePath

        public static @Nullable String getAttachmentRemotePath​(@Nullable ContentEntityObject content)
        Returns the remote path to the attachments of the given ContentEntityObject. The path commences with the application's context path.
        Returns:
        null if content is null, or else the path its attachments. Eg "/confluence/download/attachments/34253"
      • getAttachmentsPathForContent

        public static String getAttachmentsPathForContent​(@NonNull ContentEntityObject content)
        Returns the download path for all the attachments on a given content object, excluding the context path and base URL. For example, "/download/attachments/downloads/34253". You can append a slash and a filename to get the path to a particular attachment.
      • renderDefaultStylesheet

        public static String renderDefaultStylesheet()
        Returns a default stylesheet for Confluence. This includes the master styles, default theme styles and the globally configured colour scheme.
        Returns:
        string representation of a default stylesheet for Confluence
        See Also:
        DefaultTheme
      • renderSpaceStylesheet

        public static String renderSpaceStylesheet​(Space space)
        Returns a default stylesheet for Confluence. This includes the master styles, default theme styles and the space's configured colour scheme.