Example #1
0
        /// <summary>
        /// Get the index
        /// </summary>
        public Stream Index()
        {
            this.ThrowIfNotReady();

            try
            {
                WebOperationContext.Current.OutgoingResponse.ContentType = "text/html";
                WebOperationContext.Current.OutgoingResponse.Headers.Add("Content-Disposition", "filename=\"index.html\"");
                WebOperationContext.Current.OutgoingResponse.LastModified = DateTime.UtcNow;
                FhirServiceConfiguration config = ApplicationContext.Current.GetService <IConfigurationManager>().GetSection("marc.hi.ehrs.svc.messaging.fhir") as FhirServiceConfiguration;
                if (!String.IsNullOrEmpty(config.LandingPage))
                {
                    using (var fs = File.OpenRead(config.LandingPage))
                    {
                        MemoryStream ms     = new MemoryStream();
                        int          br     = 1024;
                        byte[]       buffer = new byte[1024];
                        while (br == 1024)
                        {
                            br = fs.Read(buffer, 0, 1024);
                            ms.Write(buffer, 0, br);
                        }
                        ms.Seek(0, SeekOrigin.Begin);
                        return(ms);
                    }
                }
                else
                {
                    return(typeof(FhirServiceBehavior).Assembly.GetManifestResourceStream("MARC.HI.EHRS.SVC.Messaging.FHIR.index.htm"));
                }
            }
            catch (IOException)
            {
                throw new WebFaultException(HttpStatusCode.NotFound);
            }
        }
 /// <summary>
 /// Constructor, load configuration
 /// </summary>
 public FhirMessageHandler()
 {
     this.m_configuration = ApplicationContext.Current.GetService <IConfigurationManager>().GetSection(FhirConstants.ConfigurationSectionName) as FhirServiceConfiguration;
 }
Example #3
0
 /// <summary>
 /// Constructor, load configuration
 /// </summary>
 public FhirMessageHandler()
 {
     this.m_configuration = ApplicationContext.Current.GetService <IConfigurationManager>().GetSection("marc.hi.ehrs.svc.messaging.fhir") as FhirServiceConfiguration;
 }