com.atlassian.confluence.servlet.download
Class ServeAfterTransactionDownload
java.lang.Object
com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
- All Implemented Interfaces:
- com.atlassian.plugin.servlet.DownloadStrategy
- Direct Known Subclasses:
- AttachmentDownload, ExportDownload
public abstract class ServeAfterTransactionDownload
- extends java.lang.Object
- implements com.atlassian.plugin.servlet.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.
Method Summary |
static java.lang.String |
getDecodedPathInfo(javax.servlet.http.HttpServletRequest httpServletRequest)
|
protected abstract java.io.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 org.springframework.transaction.support.TransactionCallback |
getStreamResultCallback(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
serveFile(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
|
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.atlassian.plugin.servlet.DownloadStrategy |
matches |
ServeAfterTransactionDownload
public ServeAfterTransactionDownload()
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
getDecodedPathInfo
public static java.lang.String getDecodedPathInfo(javax.servlet.http.HttpServletRequest httpServletRequest)
serveFile
public final void serveFile(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
throws com.atlassian.plugin.servlet.DownloadException
- Specified by:
serveFile
in interface com.atlassian.plugin.servlet.DownloadStrategy
- Throws:
com.atlassian.plugin.servlet.DownloadException
getStreamResultCallback
protected org.springframework.transaction.support.TransactionCallback getStreamResultCallback(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
getStreamForDownload
protected abstract java.io.InputStream getStreamForDownload(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
throws java.io.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:
java.io.IOException
Copyright © 2003-2013 Atlassian. All Rights Reserved.