com.atlassian.confluence.servlet.download
Class AttachmentDownload

java.lang.Object
  extended by com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
      extended by com.atlassian.confluence.servlet.download.AttachmentDownload
All Implemented Interfaces:
com.atlassian.plugin.servlet.DownloadStrategy
Direct Known Subclasses:
ThumbnailDownload

public class AttachmentDownload
extends ServeAfterTransactionDownload


Nested Class Summary
 
Nested classes/interfaces inherited from class com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
ServeAfterTransactionDownload.StreamResultCallback
 
Constructor Summary
AttachmentDownload()
           
 
Method Summary
 InputStream getStreamForDownload(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
          Get the input stream to serve to the client outside of the database transaction.
protected  String getUrlPrefix()
           
 boolean matches(String urlPath)
           
 void setAttachmentUrlParser(AttachmentUrlParser attachmentUrlParser)
           
protected  void setContentDispositionHeader(javax.servlet.http.HttpServletResponse httpServletResponse, String downloadFileName, String userAgent, com.atlassian.confluence.servlet.download.AttachmentDownload.DispositionType type)
          We should be able to encode the filename header per RFC 2047, but no browsers currently support it.
 void setDownloadResourceManager(DownloadResourceManager downloadResourceManager)
           
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
protected  void setHeadersForAttachment(String name, long contentLength, String contentType, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
           
 void setMimeTypeTranslator(AttachmentMimeTypeTranslator mimeTypeTranslator)
           
 
Methods inherited from class com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
getDecodedPathInfo, getStreamResultCallback, serveFile, setTransactionManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachmentDownload

public AttachmentDownload()
Method Detail

matches

public boolean matches(String urlPath)

setDownloadResourceManager

public void setDownloadResourceManager(DownloadResourceManager downloadResourceManager)

setAttachmentUrlParser

public void setAttachmentUrlParser(AttachmentUrlParser attachmentUrlParser)

setMimeTypeTranslator

public void setMimeTypeTranslator(AttachmentMimeTypeTranslator mimeTypeTranslator)

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)

getStreamForDownload

public InputStream getStreamForDownload(javax.servlet.http.HttpServletRequest httpServletRequest,
                                        javax.servlet.http.HttpServletResponse httpServletResponse)
                                 throws IOException
Description copied from class: ServeAfterTransactionDownload
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

Specified by:
getStreamForDownload in class ServeAfterTransactionDownload
Returns:
The input stream to serve, or null if nothing to serve.
Throws:
IOException

getUrlPrefix

protected String getUrlPrefix()

setHeadersForAttachment

protected void setHeadersForAttachment(String name,
                                       long contentLength,
                                       String contentType,
                                       javax.servlet.http.HttpServletRequest httpServletRequest,
                                       javax.servlet.http.HttpServletResponse httpServletResponse)

setContentDispositionHeader

protected void setContentDispositionHeader(javax.servlet.http.HttpServletResponse httpServletResponse,
                                           String downloadFileName,
                                           String userAgent,
                                           com.atlassian.confluence.servlet.download.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.



Copyright © 2003-2012 Atlassian. All Rights Reserved.