com.atlassian.jira.util.mime
Class MimeManager

java.lang.Object
  extended by com.atlassian.jira.util.mime.MimeManager

public class MimeManager
extends Object


Field Summary
static List GENERIC_MIME_TYPES
          A list of mime types that we wish to override.
 
Constructor Summary
MimeManager(InputStream mimeTypesInputStream)
           
 
Method Summary
 String getSanitisedMimeType(String existingMimeType, String fileName)
          If the existing mime type is listed in GENERIC_MIME_TYPES, then return a suggested replacement.
 String getSuggestedMimeType(String fileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENERIC_MIME_TYPES

public static final List GENERIC_MIME_TYPES
A list of mime types that we wish to override. Contains 'application/octet-stream' and 'text/xml'

Constructor Detail

MimeManager

public MimeManager(InputStream mimeTypesInputStream)
Method Detail

getSanitisedMimeType

public String getSanitisedMimeType(String existingMimeType,
                                   String fileName)
If the existing mime type is listed in GENERIC_MIME_TYPES, then return a suggested replacement. Else return the original mime type.

Useful when uploading files, and the browser is lazy / sets the wrong content type.


getSuggestedMimeType

public String getSuggestedMimeType(String fileName)


Copyright © 2002-2008 Atlassian. All Rights Reserved.