com.atlassian.confluence.servlet.download
Class ServeAfterTransactionDownload
java.lang.Object
com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
- All Implemented Interfaces:
- DownloadStrategy
- Direct Known Subclasses:
- AttachmentDownload, ExportDownload
public abstract class ServeAfterTransactionDownload
- extends Object
- implements DownloadStrategy
This abstract download strategy allows implementors to gather necessary information from a database and set HTTP
headers within a database transaction. Streaming of the actual download is done after the transaction is finished
so that the database connection lifetime is not bound to the entire request lifetime.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServeAfterTransactionDownload
public ServeAfterTransactionDownload()
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
getDecodedPathInfo
public static String getDecodedPathInfo(HttpServletRequest httpServletRequest)
serveFile
public final void serveFile(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse)
throws DownloadException
- Specified by:
serveFile
in interface DownloadStrategy
- Throws:
DownloadException
getStreamResultCallback
protected org.springframework.transaction.support.TransactionCallback getStreamResultCallback(HttpServletRequest request,
HttpServletResponse response)
getStreamForDownload
protected abstract InputStream getStreamForDownload(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse)
throws IOException
- 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