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
 String getContentDisposition(Attachment attachment, String userAgent)
          This will suggest a content disposition type (inline or attachment) for the given Attachment, respecting the settings in JIRA and taking IE badness into account.
 String getContentDisposition(String fileName, String mimeContentType, String userAgent, File file)
          This will suggest a content disposition type (inline or attachment) for the given file, respecting the settings in JIRA and taking IE badness into account.
 
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

getContentDisposition

public String getContentDisposition(Attachment attachment,
                                    String userAgent)
                             throws IOException
This will suggest a content disposition type (inline or attachment) for the given Attachment, respecting the settings in JIRA and taking IE badness into account.

Parameters:
attachment - the Attachment in play
userAgent - the browser in play
Returns:
either INLINE or ATTACHMENT ready for a Content-Disposition header
Throws:
IOException - if stuff goes wrong

getContentDisposition

public String getContentDisposition(String fileName,
                                    String mimeContentType,
                                    String userAgent,
                                    File file)
                             throws IOException
This will suggest a content disposition type (inline or attachment) for the given file, respecting the settings in JIRA and taking IE badness into account.

Parameters:
fileName - the name of the file
mimeContentType - the exisiting content type
userAgent - the browser in play
file - the File to be checked
Returns:
either INLINE or ATTACHMENT ready for a Content-Disposition header
Throws:
IOException - if stuff goes wrong


Copyright © 2002-2012 Atlassian. All Rights Reserved.