com.atlassian.jira.web.servlet
Class MimeSniffingKit

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

public class MimeSniffingKit
extends java.lang.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 java.lang.String CONTENT_DISPOSITION_ATTACHMENT
           
static java.lang.String CONTENT_DISPOSITION_INLINE
           
 
Constructor Summary
MimeSniffingKit(ApplicationProperties applicationProperties)
           
 
Method Summary
 java.lang.String getContentDisposition(Attachment attachment, java.lang.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.
 java.lang.String getContentDisposition(java.lang.String fileName, java.lang.String mimeContentType, java.lang.String userAgent, java.io.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 java.lang.String CONTENT_DISPOSITION_ATTACHMENT
See Also:
Constant Field Values

CONTENT_DISPOSITION_INLINE

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

MimeSniffingKit

public MimeSniffingKit(ApplicationProperties applicationProperties)
Method Detail

getContentDisposition

public java.lang.String getContentDisposition(Attachment attachment,
                                              java.lang.String userAgent)
                                       throws java.io.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:
java.io.IOException - if stuff goes wrong

getContentDisposition

public java.lang.String getContentDisposition(java.lang.String fileName,
                                              java.lang.String mimeContentType,
                                              java.lang.String userAgent,
                                              java.io.File file)
                                       throws java.io.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:
java.io.IOException - if stuff goes wrong


Copyright © 2002-2011 Atlassian. All Rights Reserved.