Go to file
Ryan Nowak 147c9527f3
Implement EndpointSelector and MatcherPolicy (#646)
Implement EndpointSelector and MatcherPolicy

This change makes the EndpointSelector API more concrete, and is the
beggining of removing EndpointConstraint by making it obsolete.

To that end, I'm introducing MatcherPolicy, which is a
feature-collection API for registering policies that interact with the
DfaMatcher. The two policies that we'll need to start are:
- ability to order endpoints
- ability to append 'policy' nodes to the graph

These two concepts together replace EndpointConstraint. Extending our
graph representation is a really efficient way to processing most common
scenarios.

---

In general this helps with common cases where 4 or so endpoints match
the URL, but with different HTTP methods supported on each. Today we
have to process route values and call into some 'policy' to make a
decision about which one is the winner. This change pushes this
knowledge down into the graph so that it's roughly as cheap as a
dictionary lookup, and can be done allocation-free.

The big savings here is ability to remove more candidates *before*
collecting route data.

---

Along with this change, I also built 'rejection' into the DFA node
model, you can see an example with the HTTP Method handling that I
implemented. I implemented a policy that can treat failure to resolve an
HTTP method as a 405 response by returning a failure endpoint. This is
at the heart of much of the feedback we've gotten in this area around
versioning and http method handling. We also have a version of this
feature in MVC for [Consumes].
2018-07-24 17:31:51 -07:00
.vsts-pipelines/builds Revert "Merge branch 'master' into release/2.2" 2018-07-23 09:34:06 -07:00
benchmarkapps/Benchmarks Revert "Merge branch 'master' into release/2.2" 2018-07-23 09:34:06 -07:00
benchmarks Implement EndpointSelector and MatcherPolicy (#646) 2018-07-24 17:31:51 -07:00
build Revert "Merge branch 'master' into release/2.2" 2018-07-23 09:34:06 -07:00
samples/RoutingSample.Web Change Branding 2018-07-22 16:41:59 -07:00
shared/Microsoft.AspNetCore.Routing.DecisionTree.Sources
src Implement EndpointSelector and MatcherPolicy (#646) 2018-07-24 17:31:51 -07:00
test Implement EndpointSelector and MatcherPolicy (#646) 2018-07-24 17:31:51 -07:00
.appveyor.yml Cleanup branch revert 2018-07-23 10:25:16 -07:00
.gitattributes
.gitignore
.travis.yml Cleanup branch revert 2018-07-23 10:25:16 -07:00
CONTRIBUTING.md Update CONTRIBUTING.md 2018-07-24 10:55:29 -07:00
Directory.Build.props
Directory.Build.targets
LICENSE.txt
NuGet.config
NuGetPackageVerifier.json
README.md Cleanup branch revert 2018-07-23 10:25:16 -07:00
Routing.sln Change Branding 2018-07-22 16:41:59 -07:00
Settings.StyleCop
build.cmd
build.sh
korebuild-lock.txt Revert "Merge branch 'master' into release/2.2" 2018-07-23 09:34:06 -07:00
korebuild.json Revert "Merge branch 'master' into release/2.2" 2018-07-23 09:34:06 -07:00
run.cmd
run.ps1 Cleanup branch revert 2018-07-23 10:25:16 -07:00
run.sh Cleanup branch revert 2018-07-23 10:25:16 -07:00
version.props Revert "Merge branch 'master' into release/2.2" 2018-07-23 09:34:06 -07:00

README.md

ASP.NET Routing

AppVeyor: AppVeyor

Travis: Travis

Contains routing middleware for routing requests to application logic.

This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the Home repo.