Class DefaultAttachmentSafeContentHeaderGuesser
- java.lang.Object
- 
- com.atlassian.confluence.servlet.download.DefaultAttachmentSafeContentHeaderGuesser
 
- 
- All Implemented Interfaces:
- SafeContentHeaderGuesser
 
 public class DefaultAttachmentSafeContentHeaderGuesser extends Object implements SafeContentHeaderGuesser 
- 
- 
Constructor SummaryConstructors Constructor Description DefaultAttachmentSafeContentHeaderGuesser()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>computeAttachmentHeaders(String contentType, InputStream contents, String name, String userAgent, long contentLength, boolean hasXsrfToken, Map<String,String[]> httpQueryParams)Returns a map of headers with their values.voidsetContentTypeAndDispositionHeaderBlacklist(com.atlassian.http.mime.ContentDispositionHeaderGuesser contentTypeAndDispositionHeaderBlacklist)voidsetMimeTypeTranslator(AttachmentMimeTypeTranslator mimeTypeTranslator)
 
- 
- 
- 
Method Detail- 
computeAttachmentHeaderspublic Map<String,String> computeAttachmentHeaders(String contentType, InputStream contents, String name, String userAgent, long contentLength, boolean hasXsrfToken, Map<String,String[]> httpQueryParams) throws IOException Description copied from interface:SafeContentHeaderGuesserReturns a map of headers with their values. One of these headers _must_ be 'Content-Type'.The purpose of this method is to guess a safe content type header (and associated content-disposition headers), so that it is difficult to perform xss using attachments. - Specified by:
- computeAttachmentHeadersin interface- SafeContentHeaderGuesser
- Parameters:
- contentType- the existing content-type that the attachment has.
- contents- attachment contents
- name- the filename of the attachment
- userAgent- the user agent of the client requesting the attachment
- contentLength- the length of the attachment
- httpQueryParams- a map of the http query parameters
- Returns:
- a map of http headers to their values. It will contain at least one entry with key 'Content-Type'.
- Throws:
- IOException- if the attachments contents could not be read
 
 - 
setMimeTypeTranslatorpublic void setMimeTypeTranslator(AttachmentMimeTypeTranslator mimeTypeTranslator) 
 - 
setContentTypeAndDispositionHeaderBlacklistpublic void setContentTypeAndDispositionHeaderBlacklist(com.atlassian.http.mime.ContentDispositionHeaderGuesser contentTypeAndDispositionHeaderBlacklist) 
 
- 
 
-