You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/01/15 11:56:17 UTC
svn commit: r1652044 - in /myfaces/tobago/trunk/tobago-core/src:
main/java/org/apache/myfaces/tobago/internal/util/
main/java/org/apache/myfaces/tobago/servlet/
test/java/org/apache/myfaces/tobago/internal/util/
Author: lofwyr
Date: Thu Jan 15 10:56:16 2015
New Revision: 1652044
URL: http://svn.apache.org/r1652044
Log:
checkstyle
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtils.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtilsTest.java
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtils.java?rev=1652044&r1=1652043&r2=1652044&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtils.java Thu Jan 15 10:56:16 2015
@@ -24,7 +24,7 @@ import java.util.Map;
public final class MimeTypeUtils {
- private static final Map<String, String> extensionTypeMap = new HashMap<String, String>();
+ private static final Map<String, String> EXTENSION_TYPE_MAP = new HashMap<String, String>();
public static final String DEFAULT_MAPPING = ".gif:image/gif,.png:image/png,.jpg:image/jpeg,.js:text/javascript,"
+ ".css:text/css,.ico:image/vnd.microsoft.icon,.html:text/html,.htm:text/html,.map:application/json";
@@ -39,10 +39,10 @@ public final class MimeTypeUtils {
mimeTypeMapping = DEFAULT_MAPPING;
}
try {
- extensionTypeMap.clear();
+ EXTENSION_TYPE_MAP.clear();
for (String typeMapping : mimeTypeMapping.split(",")) {
int idx = typeMapping.indexOf(':');
- extensionTypeMap.put(typeMapping.substring(0, idx).trim(), typeMapping.substring(idx + 1).trim());
+ EXTENSION_TYPE_MAP.put(typeMapping.substring(0, idx).trim(), typeMapping.substring(idx + 1).trim());
}
} catch (Exception e) {
throw new IllegalArgumentException("Invalid parameter 'mimeTypeMapping': \"" + mimeTypeMapping + "\"", e);
@@ -50,7 +50,7 @@ public final class MimeTypeUtils {
}
public static String getMimeTypeForFile(final String file) {
- for (Map.Entry<String, String> entry : extensionTypeMap.entrySet()) {
+ for (Map.Entry<String, String> entry : EXTENSION_TYPE_MAP.entrySet()) {
if (file.endsWith(entry.getKey())) {
return entry.getValue();
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java?rev=1652044&r1=1652043&r2=1652044&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java Thu Jan 15 10:56:16 2015
@@ -60,7 +60,8 @@ import java.util.Set;
* <init-param>
* <description> File extension to mimeType mapping.
* Comma separated list of <extension>:<mime-type>
- * Default is ".gif:image/gif,.png:image/png,.jpg:image/jpeg,.js:text/javascript,.css:text/css,.ico:image/vnd.microsoft.icon,.html:text/html,.htm:text/html,.map:application/json"
+ * Default is ".gif:image/gif,.png:image/png,.jpg:image/jpeg,.js:text/javascript,.css:text/css,
+ * .ico:image/vnd.microsoft.icon,.html:text/html,.htm:text/html,.map:application/json"
* .</description>
* <param-name>mimeTypeMapping</param-name>
* <param-value>.gif:image/gif,.htm:text/html</param-value>
Modified: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtilsTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtilsTest.java?rev=1652044&r1=1652043&r2=1652044&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtilsTest.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/MimeTypeUtilsTest.java Thu Jan 15 10:56:16 2015
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.tobago.internal.util;
import org.junit.Assert;
@@ -7,7 +26,7 @@ public class MimeTypeUtilsTest {
@Test
public void testGetMimeTypeForFile() throws Exception {
- MimeTypeUtils.init(null);
+ MimeTypeUtils.init(null);
Assert.assertEquals("image/gif", MimeTypeUtils.getMimeTypeForFile("image.gif"));
Assert.assertEquals("image/png", MimeTypeUtils.getMimeTypeForFile("images/red.png"));
Assert.assertEquals("image/jpeg", MimeTypeUtils.getMimeTypeForFile("images/button.jpg"));
@@ -19,4 +38,4 @@ public class MimeTypeUtilsTest {
Assert.assertEquals("application/json", MimeTypeUtils.getMimeTypeForFile("object.map"));
Assert.assertNull(MimeTypeUtils.getMimeTypeForFile("notValid.extension"));
}
-}
\ No newline at end of file
+}