Drop JAF dependency from MediaTypeFactory

This commit drops the Java Activation Framework dependency from the
MediaTypeFactory, in favor of parsing our own `mime.types` file, which
was obtained from Apache HTTPD.

Issue: SPR-14908
This commit is contained in:
Arjen Poutsma
2017-03-13 16:11:34 +01:00
committed by Rossen Stoyanchev
parent 6f075c9060
commit f0a43e5d5c
3 changed files with 1961 additions and 33 deletions

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.http;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* @author Arjen Poutsma
*/
public class MediaTypeFactoryTests {
@Test
public void getMediaType() {
assertEquals(MediaType.APPLICATION_XML, MediaTypeFactory.getMediaType("file.xml"));
assertEquals(MediaType.parseMediaType("application/javascript"), MediaTypeFactory.getMediaType("file.js"));
assertEquals(MediaType.parseMediaType("text/css"), MediaTypeFactory.getMediaType("file.css"));
}
}