Class AttachmentDownload
- java.lang.Object
-
- com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
-
- 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
-
-
Field Summary
Fields Modifier and Type Field Description static String
JWT_REQUEST_USERNAME
-
Constructor Summary
Constructors Constructor Description AttachmentDownload()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.atlassian.event.api.EventPublisher
getEventPublisher()
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 Optional<String>
getStreamingAnalyticsEventName()
protected String
getUrlPrefix()
boolean
matches(String urlPath)
protected void
publishEvents(Attachment attachment, boolean download)
void
setAttachmentSafeContentHeaderGuesser(SafeContentHeaderGuesser attachmentSafeContentHeaderGuesser)
void
setAttachmentUrlParser(AttachmentUrlParser attachmentUrlParser)
void
setDownloadResourceManager(DownloadResourceManager downloadResourceManager)
void
setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
protected void
setHeadersForAttachment(InputStream contents, String name, long contentLength, String contentType, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
void
setTokenGenerator(com.atlassian.xwork.XsrfTokenGenerator tokenGenerator)
protected void
streamResponse(InputStream fromStream, OutputStream toStream)
Captures and publishes analytics about the attachment streaming.-
Methods inherited from class com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload
getDecodedPathInfo, getStreamResultCallback, serveFile, setTransactionManager
-
-
-
-
Field Detail
-
JWT_REQUEST_USERNAME
public static final String JWT_REQUEST_USERNAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
matches
public boolean matches(String urlPath)
-
setDownloadResourceManager
public void setDownloadResourceManager(DownloadResourceManager downloadResourceManager)
-
setAttachmentUrlParser
public void setAttachmentUrlParser(AttachmentUrlParser attachmentUrlParser)
-
setEventPublisher
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
-
getEventPublisher
public com.atlassian.event.api.EventPublisher getEventPublisher()
-
setTokenGenerator
public void setTokenGenerator(com.atlassian.xwork.XsrfTokenGenerator tokenGenerator)
-
getStreamForDownload
@Nullable 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 classServeAfterTransactionDownload
- Returns:
- The input stream to serve, or null if nothing to serve.
- Throws:
IOException
-
publishEvents
protected void publishEvents(Attachment attachment, boolean download)
-
getUrlPrefix
protected String getUrlPrefix()
-
setHeadersForAttachment
protected void setHeadersForAttachment(InputStream contents, String name, long contentLength, String contentType, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) throws IOException
- Throws:
IOException
-
setAttachmentSafeContentHeaderGuesser
public void setAttachmentSafeContentHeaderGuesser(SafeContentHeaderGuesser attachmentSafeContentHeaderGuesser)
-
streamResponse
protected void streamResponse(InputStream fromStream, OutputStream toStream) throws IOException
Captures and publishes analytics about the attachment streaming.- Overrides:
streamResponse
in classServeAfterTransactionDownload
- Throws:
IOException
- Since:
- 7.12
-
-