Class AttachmentDownloadResourceManager
- java.lang.Object
-
- com.atlassian.confluence.importexport.resource.AttachmentDownloadResourceManager
-
- All Implemented Interfaces:
DownloadResourceManager,PartialDownloadResourceManager
- Direct Known Subclasses:
ThumbnailDownloadResourceManager
public class AttachmentDownloadResourceManager extends Object implements PartialDownloadResourceManager
-
-
Constructor Summary
Constructors Constructor Description AttachmentDownloadResourceManager(PermissionManager permissionManager, AttachmentManager attachmentManager, ConfluenceUserDao confluenceUserDao, AttachmentUrlParser attachmentUrlParser, ContextPathHolder contextPathHolder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AttachmentgetAttachment(String userName, String resourcePath, Map parameters, String urlPrefix)ContextPathHoldergetContextPathHolder()PartialDownloadResourceReadergetPartialResourceReader(String userName, String resourcePath, Map parameters, String requestRange)Returns aDownloadResourceReaderfor part of a downloadable resource.DownloadResourceReadergetResourceReader(String userName, String resourcePath, Map parameters)Returns aAttachmentDownloadResourceReaderfor retrieving attachment content.booleanmatches(String resourcePath)Returns a boolean to indicate whether the current DownloadResourceManager will know how to handle the given resourcePath.voidsetAttachmentManager(AttachmentManager attachmentManager)voidsetAttachmentUrlParser(AttachmentUrlParser attachmentUrlParser)voidsetConfluenceUserDao(ConfluenceUserDao confluenceUserDao)voidsetContextPathHolder(ContextPathHolder contextPathHolder)voidsetPermissionManager(PermissionManager permissionManager)
-
-
-
Constructor Detail
-
AttachmentDownloadResourceManager
public AttachmentDownloadResourceManager(PermissionManager permissionManager, AttachmentManager attachmentManager, ConfluenceUserDao confluenceUserDao, AttachmentUrlParser attachmentUrlParser, ContextPathHolder contextPathHolder)
-
-
Method Detail
-
matches
public boolean matches(String resourcePath)
Description copied from interface:DownloadResourceManagerReturns a boolean to indicate whether the current DownloadResourceManager will know how to handle the given resourcePath.- Specified by:
matchesin interfaceDownloadResourceManager- Parameters:
resourcePath- the relative URL of the resource including the application context path. For example, "/confluence/download/attachments/12345/temp.png".- Returns:
- true if the manager can handle the given resource path
-
getResourceReader
public DownloadResourceReader getResourceReader(String userName, String resourcePath, Map parameters) throws UnauthorizedDownloadResourceException, DownloadResourceNotFoundException
Returns aAttachmentDownloadResourceReaderfor retrieving attachment content. Typically used by HTML/PDF export and attachment downloads.- Specified by:
getResourceReaderin interfaceDownloadResourceManager- Parameters:
userName- the user who is retrieving the attachment content.resourcePath- the relative URL of the resource including the application context path. For example, "/confluence/download/thumbnails/12345/temp.png".parameters- a map of url parameters for the resource- Returns:
- a DownloadResourceReader to read the resource content from
- Throws:
UnauthorizedDownloadResourceException- if the user requesting the attachment content does not have the permissions to view itDownloadResourceNotFoundException- if the attachment content associated with the resourcePath cannot be found
-
getAttachment
protected Attachment getAttachment(String userName, String resourcePath, Map parameters, String urlPrefix) throws DownloadResourceNotFoundException, UnauthorizedDownloadResourceException
-
setAttachmentUrlParser
public void setAttachmentUrlParser(AttachmentUrlParser attachmentUrlParser)
-
setAttachmentManager
public void setAttachmentManager(AttachmentManager attachmentManager)
-
setPermissionManager
public void setPermissionManager(PermissionManager permissionManager)
-
setConfluenceUserDao
public void setConfluenceUserDao(ConfluenceUserDao confluenceUserDao)
-
getContextPathHolder
public ContextPathHolder getContextPathHolder()
-
setContextPathHolder
public void setContextPathHolder(ContextPathHolder contextPathHolder)
-
getPartialResourceReader
public PartialDownloadResourceReader getPartialResourceReader(String userName, String resourcePath, Map parameters, String requestRange) throws UnauthorizedDownloadResourceException, DownloadResourceNotFoundException, RangeNotSatisfiableException
Description copied from interface:PartialDownloadResourceManagerReturns aDownloadResourceReaderfor part of a downloadable resource. Currently being used by attachment downloads Use this method only ifDownloadResourceManager.matches(String)returns true.- Specified by:
getPartialResourceReaderin interfacePartialDownloadResourceManager- Parameters:
userName- the user who is retrieving the downloadable resource.resourcePath- the relative URL of the resource including the application context path. For example, "/confluence/download/attachments/12345/temp.png".parameters- a map of url paramaters for the resourcerequestRange- range of the resource as defined in RFC-2616 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1- Returns:
- a DownloadResourceReader to read the resource content from
- Throws:
UnauthorizedDownloadResourceException- if the user requesting the downloadable resource does not have the permissions to get itDownloadResourceNotFoundException- if the downloadable resource associated with the resourcePath cannot be foundRangeNotSatisfiableException- if the requested range cannot be served
-
-