Commit Graph

34 Commits

Author SHA1 Message Date
James Newton-King b6a1de5676
Validate the maximum number of route segments (#911) 2018-11-14 09:25:14 +13:00
Gert Driesen 2081160678 Improve performance and reduce allocations of TemplateSegment (#856) 2018-10-22 08:35:35 +13:00
Ryan Nowak a657c3bdf2 Updates to Parameter Transformer
- Rename -> IOutboundParameterTransformer
- Make it operate on object
- Implementing caching for constraints/tranformers for link generation
(cached as part of TemplateBinder)
2018-09-20 10:15:42 -07:00
James Newton-King 412944e1f5
Transform parameters before lower casing in link generation (#793) 2018-09-14 17:19:43 +12:00
Ryan Nowak 426a48a65a Performance improvments to LinkGenerator and TemplateBinder 2018-09-13 19:11:28 -07:00
James Newton-King cee960f3c5
Add IParameterTransformer (#750) 2018-09-12 21:45:25 +12:00
Ikebe Shodai 950d2e9b74 Fix locale sensitive unit tests 2018-09-05 20:13:25 -07:00
James Newton-King 74bfff149e
Use var in for loops (#758) 2018-08-31 08:24:41 +12:00
James Newton-King 99c4f2f36a
Support policy arguments and resolving services by constructors (#753) 2018-08-29 14:51:34 +12:00
Kiran Challa 731767837a Introducing new **catchAll parameter to allow generating links with unencoded values 2018-08-16 15:52:09 -07:00
Ryan Nowak 9e114b547d
Introduce RoutePattern (#585)
* Introduce RoutePattern

Introduces RoutePattern - a new parser and representation for routing
templates, defaults, and constraints.

This is a new representation for all of the 'inputs' to routing that is
immutable and captures 'out of line' information for defaults and
constraints.

This will allow us to unify the handling of constraints and values from
attribute style routes and conventional style routes.
2018-07-13 18:01:46 -07:00
Kiran Challa 1c7f53ae39 Fix TemplateBinder to consider null and empty string values the same 2018-07-13 10:21:55 -07:00
Kiran Challa 4184b2406d Updated to make routing always use UrlEncoder.Default and not depend on DI to get it.
[Fixes #513] RedirectToAction with Non-English Characters in Parameters and Authentication Causes Error
2018-04-12 05:15:45 -07:00
Jass Bagga 57697baedb
Tolerate leading "~/" or "/" (#509) 2018-01-11 13:00:01 -08:00
Jass Bagga 93d20ec78c
Revert Dispatcher changes (#508)
Addresses aspnet/Home#2741
2018-01-10 12:53:17 -08:00
Jass Bagga 54e96bd404
Tolerate leading "~/" or "/" (#499)
Addresses #441
2017-11-21 14:20:17 -08:00
Ryan Nowak 736b49294d Add Template abstraction
This change adds the Template as a top level abstraction. URL templating
is now a two-stage process.

First you use a 'key' to look up a Template, then you use the Template
to create the URL.

This change also has some cleanup of the way RoutePatternBinder gets
instantiated. I added a factory service so that most of the complex
things can be made internal to Dispatcher. Now it's much easier to
constuct and use. These impacts some pubternal APIs that we already
broke, but makes them actually nice :)

Also cleaned up some tests and fixed one that was broken and not
running.
2017-10-25 22:15:24 -07:00
Ryan Nowak 2d661396df Port TemplateBinder to dispatcher 2017-10-25 14:28:20 -07:00
Jass Bagga eebc7db2ca Use RoutePatternMatcher logic in TemplateMatcher (#484) 2017-10-25 14:16:04 -07:00
Ryan Nowak bd517f891f Support conversions from RouteTemplate -> RoutePattern 2017-10-20 16:58:14 -07:00
Ryan Nowak 08a64048da Redesign public API for templates
-Renamed RouteTemplate -> RoutePattern
-Made immutable
-Added Builder
-Lots of fixes to parser to support new design

There are a few small issues logged for follow-up but this is mostly in
the place I want it design-wise.
2017-10-19 09:41:45 -07:00
Jass Bagga 3a5cd6dd25 Port TemplateParser to Dispatcher project (#473)
Addresses #466
2017-10-17 11:52:26 -07:00
Nate McMaster 6b3d42f6bd Minor changes to test code to resolve xUnit2013 build errors 2017-10-05 15:26:36 -07:00
Joonas Westlin a18f59ab88 Changed expected exception message to the one defined in Resources.resx.
Removed the Debug.Assert as that caused the test runner to crash as in
this case the preceding part is not a literal.
Fixes the test runner crash.
2017-05-24 08:23:20 -07:00
Joonas Westlin f457c7b9d8 Changed expected parameter p2 to non-optional as it is non-optional in the template string.
Fixes test.
2017-05-24 08:23:20 -07:00
Nate McMaster d075f1bcea Upgrade test framework versions and fix test issues 2017-05-12 15:13:17 -07:00
Kiran Challa 755d436840 Fixed error message related to escaping curly braces. 2017-01-03 14:33:36 -08:00
Kiran Challa 4bfd663c45 [Fixes #370] Raw route values should be restored after template binder failing binding values when generating a url
- Reverted changes made in commit: 1c9a54aeb8
2017-01-03 13:23:36 -08:00
jacalvar 438ec83227 [Fixes #359] Routing is matching empty segments to parameters and defaults are wrong 2016-10-03 15:34:04 -07:00
Ryan Nowak e8ce0e7523 TreeRouter cleanup 2016-04-20 18:12:10 -07:00
Ryan Nowak 9cd3fe34a5 Improve tests for catch-all + defaults/nulls 2016-04-11 15:17:07 -07:00
Ryan Nowak a51c78da06 Remove dictionary alloc in routing
This changes TemplateMatcher to mutate RouteData.Values directly instead
of creating a new dictionary and then merging in values. This is one the
biggest single costs in routing in terms of both allocations and execution
time.

So Match now becomes TryMatch. This will dirty the state of the RVD, so
the caller needs to snapshot it before calling into it (handled
inside the TreeRouter or RouteCollection).

Some subtle changes were needed to how/when values are added to be
compatible with the existing tests. The general idea is that we add null
values for non-parameter defaults or catchalls, but only if they don't
trounce an existing value. This logic used to live in MergeValues but now
it's in TryMatch since TryMatch might be working from existing data.

Also fixed the .sln to avoid building a package that we use as shared
source.
2016-04-08 08:46:00 -07:00
N. Taylor Mullen 70d674410e Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:24:38 -08:00
N. Taylor Mullen ace4553d77 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:24:31 -08:00