protected virtual IImageMimeTypeProcessor GetMimeTypeProcessor(ImageStreamingContext context) { string responseContentType = context.ContentType; if (String.IsNullOrEmpty(responseContentType)) { if (context.IsMultiFrame) { responseContentType = "application/dicom"; } else { responseContentType = "image/jpeg"; if (!ClientAcceptable(context, responseContentType)) { responseContentType = "application/dicom"; } } } if (_processorMap.ContainsKey(context.ContentType)) { return((IImageMimeTypeProcessor)Activator.CreateInstance(_processorMap[context.ContentType])); } ImageMimeTypeProcessorExtensionPoint xp = new ImageMimeTypeProcessorExtensionPoint(); object[] plugins = xp.CreateExtensions(); bool found = false; foreach (IImageMimeTypeProcessor mimeTypeConverter in plugins) { if (mimeTypeConverter.OutputMimeType == responseContentType) { found = true; _processorMap.Add(context.ContentType, mimeTypeConverter.GetType()); if (ClientAcceptable(context, mimeTypeConverter.OutputMimeType)) { return(mimeTypeConverter); } } } if (found) { throw new WADOException(HttpStatusCode.NotAcceptable, String.Format("{0} is supported but is not acceptable by the client", responseContentType)); } else { throw new WADOException(HttpStatusCode.BadRequest, String.Format("The specified contentType '{0}' is not supported", responseContentType)); } }
static ImageStreamingHandler() { // Build the mime-type mapping var xp = new ImageMimeTypeProcessorExtensionPoint(); object[] plugins = xp.CreateExtensions(); foreach (IImageMimeTypeProcessor mimeTypeConverter in plugins) { _processorMap.Add(mimeTypeConverter.OutputMimeType, mimeTypeConverter.GetType()); } }
static ImageStreamingHandler() { // Build the mime-type mapping var xp = new ImageMimeTypeProcessorExtensionPoint(); object[] plugins = xp.CreateExtensions(); foreach (IImageMimeTypeProcessor mimeTypeConverter in plugins) { _processorMap.Add(mimeTypeConverter.OutputMimeType, mimeTypeConverter.GetType()); } }
protected virtual IImageMimeTypeProcessor GetMimeTypeProcessor(ImageStreamingContext context) { string responseContentType = context.ContentType; if (String.IsNullOrEmpty(responseContentType)) { if (context.IsMultiFrame) responseContentType = "application/dicom"; else { responseContentType = "image/jpeg"; if (!ClientAcceptable(context, responseContentType)) { responseContentType = "application/dicom"; } } } if (_processorMap.ContainsKey(context.ContentType)) { return (IImageMimeTypeProcessor) Activator.CreateInstance(_processorMap[context.ContentType]); } ImageMimeTypeProcessorExtensionPoint xp = new ImageMimeTypeProcessorExtensionPoint(); object[] plugins = xp.CreateExtensions(); bool found = false; foreach (IImageMimeTypeProcessor mimeTypeConverter in plugins) { if (mimeTypeConverter.OutputMimeType == responseContentType) { found = true; _processorMap.Add(context.ContentType, mimeTypeConverter.GetType()); if (ClientAcceptable(context, mimeTypeConverter.OutputMimeType)) { return mimeTypeConverter; } } } if (found) { throw new WADOException(HttpStatusCode.NotAcceptable, String.Format("{0} is supported but is not acceptable by the client", responseContentType)); } else { throw new WADOException(HttpStatusCode.BadRequest, String.Format("The specified contentType '{0}' is not supported", responseContentType)); } }