diff --git a/samples/RoutingSample/OwinRouteEndpoint.cs b/samples/RoutingSample/OwinRouteEndpoint.cs deleted file mode 100644 index 97b08013f6..0000000000 --- a/samples/RoutingSample/OwinRouteEndpoint.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#if NET45 - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Microsoft.AspNet.Abstractions; -using Microsoft.AspNet.PipelineCore.Owin; -using Microsoft.AspNet.Routing; - -namespace RoutingSample -{ - internal class OwinRouteEndpoint : IRouteEndpoint - { - private readonly Func, Task> _appFunc; - - public OwinRouteEndpoint(Func, Task> appFunc) - { - _appFunc = appFunc; - } - - public async Task Send(HttpContext context) - { - var owinContext = context.GetFeature().Environment; - await _appFunc(owinContext); - return true; - } - } -} - -#endif diff --git a/samples/RoutingSample/Startup.cs b/samples/RoutingSample/Startup.cs index 8a8eea7dc3..6c87a888b9 100644 --- a/samples/RoutingSample/Startup.cs +++ b/samples/RoutingSample/Startup.cs @@ -2,17 +2,9 @@ #if NET45 -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Threading.Tasks; using Microsoft.AspNet.Abstractions; using Microsoft.AspNet.Routing.Owin; using Owin; -using Microsoft.AspNet.PipelineCore.Owin; -using Microsoft.AspNet.Routing; -using System; -using Microsoft.AspNet.Abstractions; namespace RoutingSample { @@ -29,7 +21,7 @@ namespace RoutingSample { var routes = builder.UseRouter(); - var endpoint1 = new OwinRouteEndpoint(async (context) => await WriteToBodyAsync(context, "match1")); + var endpoint1 = new HttpContextRouteEndpoint(async (context) => await context.Response.WriteAsync("match1")); var endpoint2 = new HttpContextRouteEndpoint(async (context) => await context.Response.WriteAsync("Hello, World!")); routes.Add(new PrefixRoute(endpoint1, "api/store")); @@ -37,14 +29,6 @@ namespace RoutingSample routes.Add(new PrefixRoute(endpoint2, "hello/world")); routes.Add(new PrefixRoute(endpoint1, "")); } - - private static async Task WriteToBodyAsync(IDictionary context, string text) - { - var stream = (Stream)context["owin.ResponseBody"]; - - byte[] bytes = Encoding.UTF8.GetBytes(text); - await stream.WriteAsync(bytes, 0, bytes.Length); - } } }