com.atlassian.jira.web.servlet
Class MimeSniffingKit

java.lang.Object
  extended by 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 jow an atatchment should be handled

Since:
v4.1

Field Summary
static String CONTENT_DISPOSITION_ATTACHMENT
           
static String CONTENT_DISPOSITION_INLINE
           
 
Constructor Summary
MimeSniffingKit(ApplicationProperties applicationProperties)
           
 
Method Summary
 void setAttachmentResponseHeaders(Attachment attachment, String userAgent, javax.servlet.http.HttpServletResponse httpServletResponse)
          Sets the appropriate HTTP response headers on an attachment download response.
 void setAttachmentResponseHeaders(String fileName, String mimeContentType, String userAgent, BufferedInputStream inputStream, javax.servlet.http.HttpServletResponse httpServletResponse)
          Sets the appropriate HTTP response headers on an attachment download response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_DISPOSITION_ATTACHMENT

public static final String CONTENT_DISPOSITION_ATTACHMENT
See Also:
Constant Field Values

CONTENT_DISPOSITION_INLINE

public static final String CONTENT_DISPOSITION_INLINE
See Also:
Constant Field Values
Constructor Detail

MimeSniffingKit

public MimeSniffingKit(ApplicationProperties applicationProperties)
Method Detail

setAttachmentResponseHeaders

public void setAttachmentResponseHeaders(Attachment attachment,
                                         String userAgent,
                                         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:
attachment - the Attachment in play
userAgent - the User-agent request header
httpServletResponse - the attachment download response
Throws:
IOException - if stuff goes wrong

setAttachmentResponseHeaders

public void setAttachmentResponseHeaders(String fileName,
                                         String mimeContentType,
                                         String userAgent,
                                         BufferedInputStream inputStream,
                                         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
inputStream - the input stream that is being downloaded
userAgent - the User-agent request header
httpServletResponse - the attachment download response
Throws:
IOException - if stuff goes wrong


Copyright © 2002-2014 Atlassian. All Rights Reserved.