From: mh Date: Tue, 26 Feb 2002 12:23:10 +0000 (+0000) Subject: support for wildcard like base content-type mappings in media_type table. X-Git-Url: http://erislabs.net/gitweb/?p=mir.git;a=commitdiff_plain;h=a3a5ca64e2603f0e2475af061e71e67483926d74 support for wildcard like base content-type mappings in media_type table. so things like image/* will work --- diff --git a/source/mircoders/servlet/ServletModuleOpenIndy.java b/source/mircoders/servlet/ServletModuleOpenIndy.java index 66031a31..ba005bc8 100755 --- a/source/mircoders/servlet/ServletModuleOpenIndy.java +++ b/source/mircoders/servlet/ServletModuleOpenIndy.java @@ -317,7 +317,11 @@ public class ServletModuleOpenIndy extends ServletModule //from the content-type. //we use the media type entry to lookup the //media Handler/Storage classes - String wc = " mime_type='"+contentType+"'"; + //String wc = " mime_type = '"+contentType+"'"; + + // @todo this should probably be moved to DatabaseMediaType -mh + String[] cTypeSplit = StringUtil.split(contentType, "/"); + String wc = " mime_type LIKE '"+cTypeSplit[0]+"%'"; DatabaseMediaType mediaTypeStor = DatabaseMediaType.getInstance(); EntityList mediaTypesList = mediaTypeStor.selectByWhereClause(wc); @@ -329,16 +333,32 @@ public class ServletModuleOpenIndy extends ServletModule //if we found an entry matching the //content-type int the table. if (mediaTypesList.size() > 0) { + Entity mediaType = null; + + // find out if we an exact content-type match if so take it. + // otherwise just use the first one. + // @todo this should probably be moved to DatabaseMediaType -mh + for(int j=0;i