Skip to content

Commit 3db62d5

Browse files
committed
Remove MimeTypeResolver since JAF is part of Java SE 6+
The inner MimeTypeResolver class is no longer necessary in the MockServletContext since the Java Activation Framework (JAF) is a standard part of Java SE since Java 6.
1 parent da99897 commit 3db62d5

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

spring-test/src/main/java/org/springframework/mock/web/MockServletContext.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -291,7 +291,7 @@ public int getEffectiveMinorVersion() {
291291
*/
292292
@Override
293293
public String getMimeType(String filePath) {
294-
String mimeType = MimeTypeResolver.getMimeType(filePath);
294+
String mimeType = FileTypeMap.getDefaultFileTypeMap().getContentType(filePath);
295295
return ("application/octet-stream".equals(mimeType) ? null : mimeType);
296296
}
297297

@@ -680,16 +680,4 @@ public <T extends EventListener> T createListener(Class<T> c) throws ServletExce
680680
throw new UnsupportedOperationException();
681681
}
682682

683-
684-
/**
685-
* Inner factory class used to introduce a Java Activation Framework
686-
* dependency when actually asked to resolve a MIME type.
687-
*/
688-
private static class MimeTypeResolver {
689-
690-
public static String getMimeType(String filePath) {
691-
return FileTypeMap.getDefaultFileTypeMap().getContentType(filePath);
692-
}
693-
}
694-
695683
}

spring-web/src/test/java/org/springframework/mock/web/test/MockServletContext.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public int getEffectiveMinorVersion() {
291291
*/
292292
@Override
293293
public String getMimeType(String filePath) {
294-
String mimeType = MimeTypeResolver.getMimeType(filePath);
294+
String mimeType = FileTypeMap.getDefaultFileTypeMap().getContentType(filePath);
295295
return ("application/octet-stream".equals(mimeType) ? null : mimeType);
296296
}
297297

@@ -680,16 +680,4 @@ public <T extends EventListener> T createListener(Class<T> c) throws ServletExce
680680
throw new UnsupportedOperationException();
681681
}
682682

683-
684-
/**
685-
* Inner factory class used to introduce a Java Activation Framework
686-
* dependency when actually asked to resolve a MIME type.
687-
*/
688-
private static class MimeTypeResolver {
689-
690-
public static String getMimeType(String filePath) {
691-
return FileTypeMap.getDefaultFileTypeMap().getContentType(filePath);
692-
}
693-
}
694-
695683
}

0 commit comments

Comments
 (0)