@Test public void testGetMimeType() throws Exception { assertNotNull( "MimeTypes should not be null.", mime ); assertEquals( "application/pdf", mime.getMimeType( "big-book.pdf" ) ); assertEquals( "application/octet-stream", mime.getMimeType( "BookMaker.class" ) ); assertEquals( "application/vnd.ms-powerpoint", mime.getMimeType( "TypeSetting.ppt" ) ); assertEquals( "application/java-archive", mime.getMimeType( "BookViewer.jar" ) ); }
public String getMimeType( String filename ) { String value = null; if ( !StringUtils.isEmpty( filename ) ) { int index = filename.lastIndexOf( '.' ); if ( index >= 0 ) { value = (String) mimeMap.get( filename.substring( index + 1 ).toLowerCase() ); } } if ( value == null ) { value = DEFAULT_MIME_TYPE; } return value; }
MimeTypes { public String getMimeType( String filename ) { String value = null; if ( !StringUtils.isEmpty( filename ) ) { int index = filename.lastIndexOf( '.' ); if ( index >= 0 ) { value = (String) mimeMap.get( filename.substring( index + 1 ).toLowerCase() ); } } if ( value == null ) { value = DEFAULT_MIME_TYPE; } return value; } }
MimeTypes { public String getMimeType( String filename ) { String value = null; if ( !StringUtils.isEmpty( filename ) ) { int index = filename.lastIndexOf( '.' ); if ( index >= 0 ) { value = (String) mimeMap.get( filename.substring( index + 1 ).toLowerCase() ); } } if ( value == null ) { value = DEFAULT_MIME_TYPE; } return value; }  }
MimeTypes { public String getMimeType( String filename ) { String value = null; if ( !StringUtils.isEmpty( filename ) ) { int index = filename.lastIndexOf( '.' ); if ( index >= 0 ) { value = (String) mimeMap.get( filename.substring( index + 1 ).toLowerCase() ); } } if ( value == null ) { value = DEFAULT_MIME_TYPE; } return value; }  String getMimeType( String filename ); @PostConstruct void initialize(); void load( String resourceName ); void load( InputStream mimeStream ); String getResource(); void setResource( String resource ); }
MimeTypes { public String getMimeType( String filename ) { String value = null; if ( !StringUtils.isEmpty( filename ) ) { int index = filename.lastIndexOf( '.' ); if ( index >= 0 ) { value = (String) mimeMap.get( filename.substring( index + 1 ).toLowerCase() ); } } if ( value == null ) { value = DEFAULT_MIME_TYPE; } return value; }  String getMimeType( String filename ); @PostConstruct void initialize(); void load( String resourceName ); void load( InputStream mimeStream ); String getResource(); void setResource( String resource );  }