Class MimeSniffingKit

java.lang.Object
com.atlassian.jira.web.servlet.MimeSniffingKit

public class MimeSniffingKit extends Object
This class can sniff a file according to the current JIRA settings and determine how an attachment should be handled
Since:
v4.1
  • Field Details

  • 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 as Content-Disposition and X-Download-Options to force downloading rather than opening attachments.
      Parameters:
      attachment - the Attachment in play
      userAgent - the User-agent request header
      httpServletResponse - 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 as Content-Disposition and X-Download-Options to force downloading rather than opening attachments.
      Parameters:
      fileName - the name of the file
      mimeContentType - the content-type of the file
      httpServletResponse - the attachment download response
      Throws:
      IOException - if stuff goes wrong