@Test public void testResolveFromFileName() { Map<String, MediaType> map = new HashMap<>(); map.put("png", MediaType.IMAGE_PNG); MediaTypeResolver resolver = new MediaTypeResolver(map); assertThat(resolver.resolveFromFilename("hoge.png"), is(MediaType.IMAGE_PNG)); assertThat(resolver.resolveFromFilename("foo.PNG"), is(MediaType.IMAGE_PNG)); assertThat(resolver.resolveFromFilename("bar.hoge"), is(MediaType.APPLICATION_OCTET_STREAM)); }
public MediaType resolveFromFilename(String fileName) { return resolveFromExtension(Files.getFileExtension(fileName)); }
MediaTypeResolver extends MappingMediaTypeFileExtensionResolver { public MediaType resolveFromFilename(String fileName) { return resolveFromExtension(Files.getFileExtension(fileName)); } }
MediaTypeResolver extends MappingMediaTypeFileExtensionResolver { public MediaType resolveFromFilename(String fileName) { return resolveFromExtension(Files.getFileExtension(fileName)); } MediaTypeResolver(Map<String, MediaType> mediaTypes); }
MediaTypeResolver extends MappingMediaTypeFileExtensionResolver { public MediaType resolveFromFilename(String fileName) { return resolveFromExtension(Files.getFileExtension(fileName)); } MediaTypeResolver(Map<String, MediaType> mediaTypes); MediaType resolveFromExtension(String extension); MediaType resolveFromFilename(String fileName); }
MediaTypeResolver extends MappingMediaTypeFileExtensionResolver { public MediaType resolveFromFilename(String fileName) { return resolveFromExtension(Files.getFileExtension(fileName)); } MediaTypeResolver(Map<String, MediaType> mediaTypes); MediaType resolveFromExtension(String extension); MediaType resolveFromFilename(String fileName);  }