Exemplo n.º 1
0
        public virtual HttpResponseMessage RetrieveInstance(IWadoRequestHeader header, IObjectID request)
        {
            //IWadoRsMimeResponseCreator mimeResponseHandler = new WadoRsMimeResponseCreator ( ) ;
            IWadoResponseService responseService = new WadoResponseService( );
            HttpResponseMessage  response        = new HttpResponseMessage( );
            string mimeType      = null;
            var    wadoResponses = CreateRetrieveInstanceResponse(header, request, out mimeType);

            //System.Net.Http.Headers.MediaTypeWithQualityHeaderValue mediaType ;
            //if ( ((MimeMediaType)MimeMediaTypes.MultipartRelated).IsIn ( request.AcceptHeader, out mediaType ))

            MultipartContent multiContent = new MultipartContent("related", "DICOM DATA BOUNDARY");

            multiContent.Headers.ContentType.Parameters.Add(new System.Net.Http.Headers.NameValueHeaderValue("type", "\"" + mimeType + "\""));

            response.Content = multiContent;


            foreach (var wadoResponse in wadoResponses)
            {
                StreamContent sContent = new StreamContent(wadoResponse.Content);
                sContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(wadoResponse.MimeType);

                multiContent.Add(sContent);
            }

            if (wadoResponses.Count( ) == 0)
            {
                response.StatusCode = System.Net.HttpStatusCode.NotFound;
            }


            return(response);
        }
Exemplo n.º 2
0
        public virtual HttpResponseMessage RetrieveInstanceMetadata(IWadoRSInstanceRequest request)
        {
            IWadoResponseService responseService = new WadoResponseService( );
            string mimeType = null;

            var wadoResponses = CreateRetrieveInstanceResponse(request, request, out mimeType);


            return(responseService.CreateWadoRsResponse(request, wadoResponses, mimeType));
        }