import java.util.List;
import java.util.StringTokenizer;
+import javax.activation.MimetypesFileTypeMap;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.version.VersionHistory;
import javax.jcr.version.VersionIterator;
+import org.apache.commons.io.FilenameUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.ArgeoException;
int index = path.lastIndexOf('/');
String parentPath = path.substring(0, index);
+ if (parentPath.equals(""))
+ parentPath = "/";
String fileName = path.substring(index + 1);
if (!session().itemExists(parentPath))
throw new ArgeoException("Parent folder of node " + path
try {
if (!session().itemExists(path)) {
- create(path, in, null);
+ String type = new MimetypesFileTypeMap()
+ .getContentType(FilenameUtils.getName(path));
+ create(path, in, type);
return;
}