コード例 #1
0
        private HttpContent CreateResponseContent
        (
            WebStoreRequest request,
            WadoStoreResponse storeResult
        )
        {
            HttpContent content;

            //this is not taking the "q" parameter
            if (new MimeMediaType(MimeMediaTypes.Json).IsIn(request.AcceptHeader))
            {
                IJsonDicomConverter converter = GetJsonConverter();

                content = new StringContent(converter.Convert(storeResult.GetResponseContent()),
                                            System.Text.Encoding.UTF8,
                                            MimeMediaTypes.Json);
            }
            else
            {
                IXmlDicomConverter xmlConverter = GetXmlConverter();

                content = new StringContent(xmlConverter.Convert(storeResult.GetResponseContent()),
                                            System.Text.Encoding.UTF8,
                                            MimeMediaTypes.xmlDicom);
            }

            return(content);
        }
コード例 #2
0
        public virtual async Task <HttpResponseMessage> Store
        (
            WebStoreRequest request,
            string studyInstanceUID
        )
        {
            GetDicomHandler getDicomDelegate = CreateDatasetParser(request);

            if (null != getDicomDelegate)
            {
                var storeResult = await StoreStudy(request, studyInstanceUID, getDicomDelegate);

                var result = new HttpResponseMessage(storeResult.HttpStatus);


                //this is not taking the "q" parameter
                if (new MimeMediaType(MimeMediaTypes.Json).IsIn(request.AcceptHeader))
                {
                    IJsonDicomConverter converter = GetJsonConverter();

                    result.Content = new StringContent(converter.Convert(storeResult.GetResponseContent()),
                                                       System.Text.Encoding.UTF8,
                                                       MimeMediaTypes.Json);
                }
                else
                {
                    IXmlDicomConverter xmlConverter = GetXmlConverter();

                    result.Content = new StringContent(xmlConverter.Convert(storeResult.GetResponseContent()),
                                                       System.Text.Encoding.UTF8,
                                                       MimeMediaTypes.xmlDicom);
                }

                return(result);
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
        }