X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fservlet%2FServletModuleUploadedMedia.java;h=ba34a6392260daaab9be2c2154ee3db9b0f0942d;hb=a0e0629d9b38c2eb4eba6d9420ccbc6d1b44ab00;hp=d4047553b620d17c2ff5681b96099b5533966098;hpb=a459f111d85598df56c6ab711cec11632676b39c;p=mir.git diff --git a/source/mircoders/servlet/ServletModuleUploadedMedia.java b/source/mircoders/servlet/ServletModuleUploadedMedia.java index d4047553..ba34a639 100755 --- a/source/mircoders/servlet/ServletModuleUploadedMedia.java +++ b/source/mircoders/servlet/ServletModuleUploadedMedia.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -62,7 +62,7 @@ import mircoders.entity.EntityContent; import mircoders.entity.EntityUploadedMedia; import mircoders.entity.EntityUsers; import mircoders.media.MediaUploadProcessor; -import mircoders.media.UnsupportedMediaFormatExc; +import mircoders.module.*; import mircoders.storage.DatabaseComment; import mircoders.storage.DatabaseContent; import mircoders.storage.DatabaseMediafolder; @@ -76,7 +76,7 @@ import freemarker.template.SimpleList; * ServletModuleBilder - * liefert HTML fuer Bilder * - * @version $Id: ServletModuleUploadedMedia.java,v 1.26 2003/04/21 12:42:51 idfx Exp $ + * @version $Id: ServletModuleUploadedMedia.java,v 1.28 2003/04/29 02:36:51 zapata Exp $ * @author RK, the mir-coders group */ @@ -174,7 +174,7 @@ public abstract class ServletModuleUploadedMedia catch (Throwable t) { Throwable cause = ExceptionFunctions.traceCauseException(t); - if (cause instanceof UnsupportedMediaFormatExc) { + if (cause instanceof ModuleMediaType.UnsupportedMimeTypeExc) { throw new ServletModuleUserExc("media.error.unsupportedformat", new String[] {}); } throw new ServletModuleFailure("ServletModuleUploadedMedia.insert: " + t.toString(), t); @@ -391,17 +391,17 @@ public abstract class ServletModuleUploadedMedia String idParam = req.getParameter("id"); if (idParam!=null && !idParam.equals("")) { try { - EntityUploadedMedia ent = (EntityUploadedMedia)mainModule.getById(idParam); + EntityUploadedMedia ent = (EntityUploadedMedia) mainModule.getById(idParam); Entity mediaType = ent.getMediaType(); MirMedia mediaHandler; - ServletContext ctx = MirPropertiesConfiguration.getContext(); - String fName = ent.getId()+"."+mediaType.getValue("name"); - mediaHandler = MediaHelper.getHandler(mediaType); InputStream in = mediaHandler.getIcon(ent); - res.setContentType(ctx.getMimeType(fName)); + if (in==null) + throw new ServletModuleExc("no icon available"); + + res.setContentType(mediaHandler.getIconMimeType(ent, mediaType)); //important that before calling this res.getWriter was not called first ServletOutputStream out = res.getOutputStream();