public class

AttachmentUrlParser

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.servlet.download.AttachmentUrlParser

Class Overview

A URL parser for attachments (including thumbnails). See FileServerServlet for URL prefix constants.

Summary

Constants
String MODIFICATION_DATE_PARAMETER
String VERSION_PARAMETER
Public Constructors
AttachmentUrlParser()
Public Methods
Attachment getAttachment(String urlPath, String urlPrefix, Map parameters)
Gets the attachment based on the url, prefix and query parameters.
String getAttachmentFileName(String urlPath)
ContentEntityObject getEntity(String urlPath, String prefix)
Gets the entity that the attachment is attached to based on the given url.
long getEntityId(String urlPath, String prefix)
Gets the entity id that the attachment is attached to based on the given url.
void setAttachmentManager(AttachmentManager attachmentManager)
void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String MODIFICATION_DATE_PARAMETER

Constant Value: "modificationDate"

public static final String VERSION_PARAMETER

Constant Value: "version"

Public Constructors

public AttachmentUrlParser ()

Public Methods

public Attachment getAttachment (String urlPath, String urlPrefix, Map parameters)

Gets the attachment based on the url, prefix and query parameters.

Parameters
urlPath the attachment url path
urlPrefix the url prefix up to the entity id
parameters query parameters from the url
Returns
  • an Attachment object, or null if the urlPath did not match an attachment

public String getAttachmentFileName (String urlPath)

public ContentEntityObject getEntity (String urlPath, String prefix)

Gets the entity that the attachment is attached to based on the given url. If the url cannot be parsed to extract the entity id, null is returned.

Parameters
urlPath the attachment url path
prefix the url prefix up to the entity id

public long getEntityId (String urlPath, String prefix)

Gets the entity id that the attachment is attached to based on the given url. If the url cannot be parsed to extract the entity id, -1 is returned.

Parameters
urlPath the attachment url path
prefix the url prefix up to the entity id

public void setAttachmentManager (AttachmentManager attachmentManager)

public void setContentEntityObjectDao (ContentEntityObjectDao contentEntityObjectDao)