Added temporary owin glue for HttpAbstractions based on Microsoft.Owin.
This commit is contained in:
parent
7637ca17dc
commit
a8b4c71284
|
|
@ -27,6 +27,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{1D737C82-F
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.PipelineCore.Tests", "test\Microsoft.AspNet.PipelineCore.Tests\Microsoft.AspNet.PipelineCore.Tests.csproj", "{86942914-0334-4352-87ED-B971281C74E2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.PipelineCore.Tests", "test\Microsoft.AspNet.PipelineCore.Tests\Microsoft.AspNet.PipelineCore.Tests.csproj", "{86942914-0334-4352-87ED-B971281C74E2}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Abstractions.Owin.net45", "src\Microsoft.AspNet.Abstractions.Owin\Microsoft.AspNet.Abstractions.Owin.net45.csproj", "{3D838D54-3F3B-4E5C-81DF-68875FDD2B7A}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -73,6 +75,10 @@ Global
|
||||||
{86942914-0334-4352-87ED-B971281C74E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{86942914-0334-4352-87ED-B971281C74E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{86942914-0334-4352-87ED-B971281C74E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{86942914-0334-4352-87ED-B971281C74E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{86942914-0334-4352-87ED-B971281C74E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
{86942914-0334-4352-87ED-B971281C74E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3D838D54-3F3B-4E5C-81DF-68875FDD2B7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3D838D54-3F3B-4E5C-81DF-68875FDD2B7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3D838D54-3F3B-4E5C-81DF-68875FDD2B7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3D838D54-3F3B-4E5C-81DF-68875FDD2B7A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -88,5 +94,6 @@ Global
|
||||||
{68A538BA-D542-49CB-9615-B4F5A4E78C87} = {D38DDB2B-1138-4F45-8A6A-9499E880F620}
|
{68A538BA-D542-49CB-9615-B4F5A4E78C87} = {D38DDB2B-1138-4F45-8A6A-9499E880F620}
|
||||||
{E31D45AC-70F3-47D4-9625-A4D8C6AA1B6B} = {D38DDB2B-1138-4F45-8A6A-9499E880F620}
|
{E31D45AC-70F3-47D4-9625-A4D8C6AA1B6B} = {D38DDB2B-1138-4F45-8A6A-9499E880F620}
|
||||||
{D36288AF-8A0E-48DD-8AF8-15B72F91C70A} = {D38DDB2B-1138-4F45-8A6A-9499E880F620}
|
{D36288AF-8A0E-48DD-8AF8-15B72F91C70A} = {D38DDB2B-1138-4F45-8A6A-9499E880F620}
|
||||||
|
{3D838D54-3F3B-4E5C-81DF-68875FDD2B7A} = {D38DDB2B-1138-4F45-8A6A-9499E880F620}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{3D838D54-3F3B-4E5C-81DF-68875FDD2B7A}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Microsoft.AspNet.Abstractions.Owin</RootNamespace>
|
||||||
|
<AssemblyName>Microsoft.AspNet.Abstractions.Owin</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<BaseIntermediateOutputPath>obj/net45</BaseIntermediateOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\net45</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE;NET45</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\net45</OutputPath>
|
||||||
|
<DefineConstants>TRACE;NET45</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="mscorlib"/>
|
||||||
|
<Reference Include="System"/>
|
||||||
|
<Reference Include="System.Core"/>
|
||||||
|
<Reference Include="Microsoft.CSharp"/>
|
||||||
|
|
||||||
|
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="OwinExtensions.cs" />
|
||||||
|
<Compile Include="OwinHttpContext.cs" />
|
||||||
|
<Content Include="project.json"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNet.Abstractions\Microsoft.AspNet.Abstractions.net45.csproj">
|
||||||
|
<Project>{D36288AF-8A0E-48DD-8AF8-15B72F91C70A}</Project>
|
||||||
|
<Name>Microsoft.AspNet.Abstractions</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Abstractions.Owin;
|
||||||
|
|
||||||
|
namespace Owin
|
||||||
|
{
|
||||||
|
public static class OwinExtensions
|
||||||
|
{
|
||||||
|
public static void RunHttpContext(this IAppBuilder app, Func<OwinHttpContext, Task> handler)
|
||||||
|
{
|
||||||
|
app.Run(context =>
|
||||||
|
{
|
||||||
|
var httpContext = new OwinHttpContext(context);
|
||||||
|
|
||||||
|
return handler(httpContext);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,175 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Abstractions;
|
||||||
|
using Microsoft.Owin;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNet.Abstractions.Owin
|
||||||
|
{
|
||||||
|
public class OwinHttpContext : HttpContext
|
||||||
|
{
|
||||||
|
private readonly IOwinContext _context;
|
||||||
|
private readonly HttpRequest _request;
|
||||||
|
private readonly HttpResponse _response;
|
||||||
|
|
||||||
|
public OwinHttpContext(IOwinContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_request = new OwinHttpRequest(this, context.Request);
|
||||||
|
_response = new OwinHttpResponse(this, context.Response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object GetInterface(Type type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override HttpRequest Request
|
||||||
|
{
|
||||||
|
get { return _request; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override HttpResponse Response
|
||||||
|
{
|
||||||
|
get { return _response; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetInterface(Type type, object instance)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class OwinHttpRequest : HttpRequest
|
||||||
|
{
|
||||||
|
private HttpContext _context;
|
||||||
|
private IOwinRequest _request;
|
||||||
|
|
||||||
|
public OwinHttpRequest(HttpContext context, IOwinRequest request)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_request = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Stream Body
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _request.Body;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_request.Body = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override HttpContext HttpContext
|
||||||
|
{
|
||||||
|
get { return _context; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Microsoft.AspNet.Abstractions.PathString Path
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new Microsoft.AspNet.Abstractions.PathString(_request.Path.Value);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_request.Path = new Microsoft.Owin.PathString(value.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Microsoft.AspNet.Abstractions.PathString PathBase
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new Microsoft.AspNet.Abstractions.PathString(_request.PathBase.Value);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_request.PathBase = new Microsoft.Owin.PathString(value.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Microsoft.AspNet.Abstractions.QueryString QueryString
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new Microsoft.AspNet.Abstractions.QueryString(_request.QueryString.Value);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_request.QueryString = new Microsoft.Owin.QueryString(value.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Uri Uri
|
||||||
|
{
|
||||||
|
get { return _request.Uri; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class OwinHttpResponse : HttpResponse
|
||||||
|
{
|
||||||
|
private readonly HttpContext _context;
|
||||||
|
private readonly IOwinResponse _response;
|
||||||
|
|
||||||
|
public OwinHttpResponse(HttpContext context, IOwinResponse response)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_response = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Stream Body
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _response.Body;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_response.Body = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ContentType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _response.ContentType;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_response.ContentType = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override HttpContext HttpContext
|
||||||
|
{
|
||||||
|
get { return _context; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int StatusCode
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _response.StatusCode;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_response.StatusCode = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task WriteAsync(string data)
|
||||||
|
{
|
||||||
|
return _response.WriteAsync(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"version": "0.1-alpha-*",
|
||||||
|
"dependencies": {
|
||||||
|
"Owin": "1.0",
|
||||||
|
"Microsoft.Owin": "2.1.0",
|
||||||
|
"Microsoft.AspNet.Abstractions": ""
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"net45": { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30124-097\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30125-098\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30124-097\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30125-098\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
<Name>Microsoft.AspNet.FeatureModel</Name>
|
<Name>Microsoft.AspNet.FeatureModel</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30124-097\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30125-098\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30124-097\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30125-098\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
<Name>Microsoft.AspNet.HttpFeature</Name>
|
<Name>Microsoft.AspNet.HttpFeature</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30124-097\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
<Import Project="..\..\packages\ProjectK.0.0.1-pre-30125-098\Framework\K\v1.0\ProjectK.CSharp.targets"/>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue