[Yanel-commits] rev 37374 -
public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node
michi at wyona.com
michi at wyona.com
Thu Jul 3 15:06:03 CEST 2008
Author: michi
Date: 2008-07-03 15:06:02 +0200 (Thu, 03 Jul 2008)
New Revision: 37374
Modified:
public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java
Log:
compare upload request content type with suffix based guess re mime type and log warning appropriately
Modified: public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java
===================================================================
--- public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java 2008-07-03 10:16:34 UTC (rev 37373)
+++ public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java 2008-07-03 13:06:02 UTC (rev 37374)
@@ -104,6 +104,7 @@
*
*/
public String getMimeType(String viewId) throws Exception {
+ // TODO: Also check mime type of data repository node
String mimeType = getResourceConfigProperty("mime-type");
@@ -323,6 +324,13 @@
InputStream is = yanelRequest.getInputStream(name);
Streams.copy(is, output, true);
uploadMimeType = yanelRequest.getContentType(name);
+
+ String suffix = PathUtil.getSuffix(newNode.getPath());
+ if (suffix != null) {
+ if (!getMimeTypeBySuffix(suffix).equals(uploadMimeType)) {
+ log.warn("Upload request content type '" + uploadMimeType + "' is NOT the same as the guessed mime type '" + getMimeTypeBySuffix(suffix) + "' based on the suffix (Path: " + newNode.getPath() + ")");
+ }
+ }
newNode.setMimeType(uploadMimeType);
}
} else {
@@ -357,6 +365,7 @@
java.util.HashMap map = new java.util.HashMap();
String mimeType = request.getParameter("rp.mime-type");
if (mimeType == null) {
+ log.warn("No mime type has been set explicitely! Use content type of upload request: " + this.uploadMimeType);
mimeType = this.uploadMimeType;
}
map.put("mime-type", mimeType);
More information about the Yanel-commits
mailing list