Package com.atlassian.jira.web.servlet
Class MimeSniffingKit
java.lang.Object
com.atlassian.jira.web.servlet.MimeSniffingKit
This class can sniff a file according to the current JIRA settings and determine how an attachment should be handled
- Since:
- v4.1
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMimeSniffingKit(ApplicationProperties applicationProperties, com.atlassian.http.mime.HostileExtensionDetector hostileExtensionDetector) -
Method Summary
Modifier and TypeMethodDescriptionvoidsetAttachmentResponseHeaders(CommonAttachment attachment, String userAgent, javax.servlet.http.HttpServletResponse httpServletResponse) Sets the appropriate HTTP response headers on an attachment download response.voidsetAttachmentResponseHeaders(String fileName, String mimeContentType, javax.servlet.http.HttpServletResponse httpServletResponse) Sets the appropriate HTTP response headers on an attachment download response.
-
Field Details
-
CONTENT_DISPOSITION_ATTACHMENT
- See Also:
-
CONTENT_DISPOSITION_INLINE
- See Also:
-
-
Constructor Details
-
MimeSniffingKit
public MimeSniffingKit(ApplicationProperties applicationProperties, com.atlassian.http.mime.HostileExtensionDetector hostileExtensionDetector)
-
-
Method Details
-
setAttachmentResponseHeaders
public void setAttachmentResponseHeaders(CommonAttachment attachment, String userAgent, javax.servlet.http.HttpServletResponse httpServletResponse) Sets the appropriate HTTP response headers on an attachment download response. Depending on the JIRA security settings and the browser making the request, this can contain headers such asContent-DispositionandX-Download-Optionsto force downloading rather than opening attachments.- Parameters:
attachment- the Attachment in playuserAgent- the User-agent request headerhttpServletResponse- the attachment download response
-
setAttachmentResponseHeaders
public void setAttachmentResponseHeaders(String fileName, String mimeContentType, javax.servlet.http.HttpServletResponse httpServletResponse) throws IOException Sets the appropriate HTTP response headers on an attachment download response. Depending on the JIRA security settings and the browser making the request, this can contain headers such asContent-DispositionandX-Download-Optionsto force downloading rather than opening attachments.- Parameters:
fileName- the name of the filemimeContentType- the content-type of the filehttpServletResponse- the attachment download response- Throws:
IOException- if stuff goes wrong
-