public class

AttachmentDownload

extends ServeAfterTransactionDownload
java.lang.Object
   ↳ com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
     ↳ com.atlassian.confluence.servlet.download.AttachmentDownload
Known Direct Subclasses

Summary

Public Constructors
AttachmentDownload()
Public Methods
InputStream getStreamForDownload(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
Get the input stream to serve to the client outside of the database transaction.
boolean matches(String urlPath)
void setAttachmentUrlParser(AttachmentUrlParser attachmentUrlParser)
void setDownloadResourceManager(DownloadResourceManager downloadResourceManager)
void setEventManager(EventManager eventManager)
void setMimeTypeTranslator(AttachmentMimeTypeTranslator mimeTypeTranslator)
Protected Methods
String getUrlPrefix()
void setContentDispositionHeader(HttpServletResponse httpServletResponse, String downloadFileName, String userAgent, AttachmentDownload.DispositionType type)
We should be able to encode the filename header per RFC 2047, but no browsers currently support it.
void setHeadersForAttachment(String name, long contentLength, String contentType, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
[Expand]
Inherited Methods
From class com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
From class java.lang.Object
From interface com.atlassian.plugin.servlet.DownloadStrategy

Public Constructors

public AttachmentDownload ()

Public Methods

public InputStream getStreamForDownload (HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)

Get the input stream to serve to the client outside of the database transaction. The inputstream must be useable outside of the database transaction that created it

Returns
  • The input stream to serve, or null if nothing to serve.
Throws
IOException

public boolean matches (String urlPath)

public void setAttachmentUrlParser (AttachmentUrlParser attachmentUrlParser)

public void setDownloadResourceManager (DownloadResourceManager downloadResourceManager)

public void setEventManager (EventManager eventManager)

public void setMimeTypeTranslator (AttachmentMimeTypeTranslator mimeTypeTranslator)

Protected Methods

protected String getUrlPrefix ()

protected void setContentDispositionHeader (HttpServletResponse httpServletResponse, String downloadFileName, String userAgent, AttachmentDownload.DispositionType type)

We should be able to encode the filename header per RFC 2047, but no browsers currently support it. So for non-ASCII filenames, we'll omit this header, and good browsers will use the filename from the URL, for which they know the proper encoding. MSIE will only understand a filename URL-encoded in the header, which is weird, but some user-agent matching fixes that.

protected void setHeadersForAttachment (String name, long contentLength, String contentType, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)