org.overlord.sramp.common
Class MimeTypes

java.lang.Object
  extended by org.overlord.sramp.common.MimeTypes

public class MimeTypes
extends Object

Helps figure out mime types for artifacts. Used by the client and the server.

Author:
eric.wittmann@redhat.com

Constructor Summary
MimeTypes()
           
 
Method Summary
static String determineMimeType(String contentType, String fileName, ArtifactType artifactType)
          Figures out the mime type of the new artifact given the POSTed Content-Type, the name of the uploaded file, and the S-RAMP arifact type.
static String getContentType(String name)
          Returns the content-type for the given file/resource/artifact name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeTypes

public MimeTypes()
Method Detail

getContentType

public static String getContentType(String name)
Returns the content-type for the given file/resource/artifact name.

Parameters:
name -
Returns:
an appropriate content-type

determineMimeType

public static String determineMimeType(String contentType,
                                       String fileName,
                                       ArtifactType artifactType)
Figures out the mime type of the new artifact given the POSTed Content-Type, the name of the uploaded file, and the S-RAMP arifact type. If the artifact type is Document then the other two pieces of information are used to determine an appropriate mime type. If no appropriate mime type can be determined for core/Document, then binary is returned.

Parameters:
contentType - the content type request header
fileName - the slug request header
artifactType - the artifact type (based on the endpoint POSTed to)


Copyright © 2011-2013 JBoss, a division of Red Hat. All Rights Reserved.