com.atlassian.confluence.servlet.download
Class AttachmentUrlParser

java.lang.Object
  extended by com.atlassian.confluence.servlet.download.AttachmentUrlParser

public class AttachmentUrlParser
extends java.lang.Object

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


Constructor Summary
AttachmentUrlParser()
           
 
Method Summary
 Attachment getAttachment(java.lang.String urlPath, java.lang.String urlPrefix, java.util.Map parameters)
          Gets the attachment based on the url, prefix and query parameters.
 java.lang.String getAttachmentFileName(java.lang.String urlPath)
           
 ContentEntityObject getEntity(java.lang.String urlPath, java.lang.String prefix)
          Gets the entity that the attachment is attached to based on the given url.
 long getEntityId(java.lang.String urlPath, java.lang.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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachmentUrlParser

public AttachmentUrlParser()
Method Detail

getAttachment

public Attachment getAttachment(java.lang.String urlPath,
                                java.lang.String urlPrefix,
                                java.util.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

getEntity

public ContentEntityObject getEntity(java.lang.String urlPath,
                                     java.lang.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

getEntityId

public long getEntityId(java.lang.String urlPath,
                        java.lang.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

getAttachmentFileName

public java.lang.String getAttachmentFileName(java.lang.String urlPath)

setContentEntityObjectDao

public void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)

setAttachmentManager

public void setAttachmentManager(AttachmentManager attachmentManager)


Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.