예제 #1
0
        private async Task GetManifestUI(HttpContext context)
        {
            context.Response.ContentType = "text/html";

            if (this.cachedHtml == null)
            {
                this.cachedHtml = await ResourcesFetcher.GetNAMEUiAsync(this.BuildRelativeNAMEPath(context.Request));
            }

            await context.Response.WriteAsync(this.cachedHtml);
        }
예제 #2
0
        private async Task GetManifestUI(HttpContext context)
        {
            context.Response.ContentType = "text/html";

            UriBuilder builder = new UriBuilder(context.Request.Scheme, context.Request.Host.Host, context.Request.Host.Port ?? 80, this.BuildRelativeNAMEPath(context.Request));

            if (this.cachedHtml == null)
            {
                this.cachedHtml = await ResourcesFetcher.GetNAMEUiAsync(builder.Uri.AbsoluteUri);
            }

            await context.Response.WriteAsync(this.cachedHtml);
        }
예제 #3
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            if (!this.settings.IsManifestEndpointEnabled())
            {
                return(new HttpResponseMessage(HttpStatusCode.NotFound));
            }

            string manifestLink = request.GetUrlHelper().Link("NAME_Manifest", new { });

            if (this.cachedHtml == null)
            {
                this.cachedHtml = await ResourcesFetcher.GetNAMEUiAsync(manifestLink);
            }

            var content = new StringContent(this.cachedHtml);

            content.Headers.ContentType = new MediaTypeHeaderValue("text/html");

            return(new HttpResponseMessage {
                Content = content
            });
        }