Commit Graph

271 Commits

Author SHA1 Message Date
Pranav K 2f8dba6659 Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:48 -07:00
Ajay Bhargav Baaskaran d5d11eb30e Fix case sensitive comparison in TemplateMatcher 2015-09-29 14:36:42 -07:00
Ryan Nowak f95ffb57ae Make dictionary allocations lazy on RouteData
This change makes the allocation of DataTokens and Values on RouteData
lazy, and elides copies when copying an 'empty' RouteData.

In our current architecture this change will eliminiate 2 * (N + 1)
dictionary allocations/copies per request, where N is the number of routes
processed. In a large system with lots of attribute routes, this number
could be very significant.

For a small MVC site (ModelBinding, Validation, Views) with one route, it
still shows a modest reduction of dictionary allocations without adding
much complexity.
2015-09-28 22:54:32 -07:00
Anthony van der Hoorn 59b698c8b2 Expose parsed route so that observers can get extra details about the route (i.e. optional state) 2015-09-23 09:00:28 -07:00
Pranav K c6941e797f Replacing NotNullAttribute with exceptions 2015-09-11 15:08:04 -07:00
Pranav K 7cd8db6695 Adding NeutralResourcesLanguageAttribute 2015-09-10 18:29:07 -07:00
Ajay Bhargav Baaskaran ee9945f06d Added timeout to regex 2015-09-10 15:21:56 -07:00
LBi Jeroen Slor 87360d861f Added configure options. Added default default addoptions call 2015-09-04 08:48:46 -07:00
N. Taylor Mullen 5ec25174ff Update project.json to have warningsAsErrors accept a bool. 2015-09-02 15:34:53 -07:00
Hao Kung 3cab10cfd7 React to options rename 2015-09-02 13:55:39 -07:00
Pranav K 8915d428c4 Reacting to DI changes 2015-08-11 14:10:55 -07:00
Troy Dai eb266a1a7c Update CoreCLR versions 2015-08-04 10:15:32 -07:00
Pranav K fe9bf8bcbf Remove the use of Regex in the TemplateRouteParser
Fixes #164
2015-08-03 11:13:57 -07:00
Victor Hurdugaci f135b7d8dd Add repository information to project files 2015-07-01 20:22:39 -07:00
Ajay Bhargav Baaskaran 0882a393a4 Removed unwanted logging for non-matching routes 2015-06-23 10:53:58 -07:00
Ajay Bhargav Baaskaran b135a9d53b [Fixes #188] Added support for AppendTrailingSlash in RouteOptions 2015-06-19 11:46:25 -07:00
Ajay Bhargav Baaskaran 7172608722 Using LogVerbose instead of LogInformation 2015-06-16 14:33:05 -07:00
Troy Dai d3b0aba9b8 React to common package name change 2015-05-07 09:40:03 -07:00
Hisham Abdullah Bin Ateya 8636477b85 Using [NotNull] and 'nameof' operator 2015-05-06 17:43:19 +03:00
Kiran Challa f2e6c294b0 Address feedback for PR: https://github.com/aspnet/Routing/pull/182 2015-05-05 12:39:32 -07:00
N. Taylor Mullen 352732fc62 Update LICENSE.txt and license header on files. 2015-05-01 13:59:22 -07:00
Kiran Challa 1f6d3fe4cc Fix RouteValueDictionary to handle read-only dictionaries. 2015-05-01 11:55:01 -07:00
Pranav K f6e48d0080 Reacting to Logging.Interfaces => Logging.Abstractions rename 2015-04-30 10:02:47 -07:00
unknown d76b332a53 Updata _dataToken to _dataTokens in VirtualPathData 2015-04-14 16:14:36 -07:00
Kiran Challa 1c66e0a317 Cleanup logging
- Removed existing logger scopes as we want to minimize the number of scopes being created.
- Cleaned up tests related to removal of scopes.
- Added new log statements.
- Removed old logger structure base implementation and related tests. Added new tests also.
2015-04-08 14:20:36 -07:00
N. Taylor Mullen 7a2c338d25 Merge branch 'release' into dev 2015-04-07 14:49:17 -07:00
N. Taylor Mullen bca280d974 Add serviceable attribute to projects.
aspnet/DNX#1600
2015-04-07 14:49:11 -07:00
Doug Bunting a58ad8cde9 Merge remote-tracking branch 'origin/release' into dev 2015-04-03 12:10:47 -07:00
Doug Bunting 458a0f6809 Update .xproj files for Microsoft.Web.AspNet.* -> Microsoft.DNX.* rename 2015-04-02 13:49:28 -07:00
N. Taylor Mullen e825776663 Add travis-ci support.
- Runs ./build.sh verify
- Added quotes on warningsAsErrors to work around mono bug.
2015-03-31 17:50:43 -07:00
ianhong ff209f04bb Should GetVirtualPath returns PathString 2015-03-22 19:39:20 -07:00
Kiran Challa fe5b6d67c5 Fix routing sample 2015-03-20 14:55:05 -07:00
ianhong 3693002b02 Introducing VirtualPathData for IRouter.GetVirtualPath 2015-03-19 21:59:20 -07:00
Hao Kung 0db1f1a42f React to hosting 2015-03-19 21:02:35 -07:00
sornaks 37dc8581de Removing 'Options' from the 'ConfigureRouteOptions' extension method name. 2015-03-16 14:54:36 -07:00
Praburaj fb08460770 Using [NotNull] from common repo package 2015-03-13 17:54:16 -07:00
Praburaj 61e4f55075 Moving the IServiceCollection extension into Microsoft.Framework.DependencyInjection namespace
Fixes: https://github.com/aspnet/Routing/issues/160
2015-03-13 14:55:49 -07:00
N. Taylor Mullen 81c43301d3 Update .kproj => .xproj. 2015-03-11 14:04:11 -07:00
N. Taylor Mullen 2973795a6e Remove BOM from project.json, *.cmd, *.sh and *.shade files. 2015-03-09 12:58:37 -07:00
N. Taylor Mullen da775351e2 Update aspnet50/aspnetcore50 => dnx451/dnxcore50. 2015-03-08 12:55:34 -07:00
David Fowler f46b373acb Depend on interfaces 2015-03-05 03:27:15 -08:00
Brennan 1e6b34a043 Documentation 2015-03-04 20:41:40 -08:00
Brennan 859a0d62b8 Logging API changes 2015-03-04 19:59:23 -08:00
Hao Kung 979b75dda4 React to DI changes 2015-03-04 18:06:42 -08:00
Mugdha Kulkarni 81a17300b2 Issue 140: Support lower case routes 2015-02-20 14:54:25 -08:00
Mugdha Kulkarni f9a9b80681 Fixing the error message. The error message for malformed template was too complex listing all
the errors that can happen in one message. I have separated the message in 2 different messages.
 1. When there is a parameter or a literal following the optional parameter.
 2. when optional parameter is preceded by a literal other than period which is not allowed.
2015-02-16 17:40:04 -08:00
Ryan Nowak 9ee946073a Add support for best-effort link-generation
This change adds a feature needed for aspnet/Mvc#302

There's a new option in routing that allows link-generation to proceed
when the route values cannot be validated. The key scenario for this is
during development of an MVC site. Routing will refuse to generate a link
to actions which don't exists, this is a breaking change from the MVC5
behavior. Setting UseBestEffortLinkGeneration will allow routing to return
a value even when we can't match the action.

This option will remain off by default - setting this to on will impact
link-generation in a bunch of scenarios involving areas where we've
improved the logic for MVC6. If you're considering leaving this on outside
of development scenarios, then make sure to be as explicit with route values
as possible (don't rely on ambient values).

Functional tests to follow up in the MVC repo.
2015-02-11 14:38:30 -08:00
Mugdha Kulkarni 4e5fc2e2dd Fixing Routing Issue: 136
The RegEx inline constraint doesn't take care of Escape characters.
2015-02-10 11:16:30 -08:00
sornaks 67dcdbf8a1 Issue #1669: Adding extension method ConfigureRouteOptions. 2015-02-03 16:18:19 -08:00
Doug Bunting c59366e8a7 Quick cleanup
- `DefaultInlineConstraintResolver` has no need of a `IServiceProvider`

nits:
- add doc comments for changed `DefaultInlineConstraintResolver` ctor
- let VS add a dev server port to sample's .kproj
- add debugSettings.json and .vs/ to .gitignore
2015-01-30 10:02:58 -08:00
Pranav K 29a5cb8aa9 Change the namespace for the MapRoute extension 2015-01-23 16:08:38 -08:00
Mugdha Kulkarni 3626900bc9 Basic URL Extension functionality working.
1. Template parser now allows a parameter to be an optional parameter in a complex segment if
   it is the last and only optional parameter and it is followed by a period.
2. Template matcher modified to take into consideration the optional parameter in the complex
   segment. Also the period shouldn't be present if the optional parameter is not present
2015-01-16 16:25:53 -08:00
Chris Ross 01620d487e Update QueryBuilder dependency. 2015-01-12 10:34:39 -08:00
Yishai Galatzer 1bded288bf Missing setter for default handler on IRouteBuilder
CR in person with pranavkm
2014-12-04 17:33:45 -08:00
Mugdha Kulkarni f549a550a9 Fixing the issue #123.
Added OptionalRouteConstraint class to take care of optional inline parameter. It will create the OptionalRouteConstraint for a inline parameter that is optional with real constraint on the parameter as inner constraint of OptionalRouteConstraint.
2014-12-04 10:54:27 -08:00
Victor Hurdugaci 8b93a0c018 Add schema version to kproj files 2014-11-25 11:01:35 -08:00
Hao Kung 21a6f44c38 GetDefaultServices -> AddRouting with TryAdd 2014-11-24 16:37:10 -08:00
Doug Bunting 9d7f971833 Add xml-docs-test target to end of default build
- #EngineeringDay
- correct couple of XML doc issues in the repo (simplify references)
2014-11-20 10:16:01 -08:00
Doug Bunting 3b0e289387 Apply VS' FormatDocument and RemoveAndSort to all *.cs files
- #EngineeringDay
- this repo was relatively clean
2014-11-20 10:09:28 -08:00
Doug Bunting 1a101d7815 Delete trailing whitespace
- #EngineeringDay
- Total replaced: 105  Matching files: 44 in *.cs files
- Total replaced: 27  Matching files: 1 in all other files
2014-11-20 09:40:12 -08:00
Ajay Bhargav Baaskaran 91c3a550f1 changed contracts.assert to debug.assert 2014-11-18 13:52:42 -08:00
Ryan Nowak 01345eca91 Fix for #92 - Make Constraints, DataTokens, and Defaults readonly
The properties on TemplateRoute for DataTokens and Defaults are now
readonly. This prevents modifying these collections in a way that
invalidates cached data, or violates thread-safety.

To do the same for constraints, this change includes a substantial refactor
of how we realize inline constraints, and moves the constraint resolver
out of the parsing phase.

This allow creates a builder for the constraint map, that will make it
easier to implement features like optional constraints, and is reusable
for anyone building their own type of routing system.
2014-11-18 11:24:25 -08:00
SonjaKhan 673854b060 renaming TraceType to LogLevel 2014-11-05 10:47:42 -08:00
Ryan Nowak 08c591c74b Fix for #104 - RouterMiddleware should take ILoggerFactory in the
constructor

Did some cleanup here to make these tests work on CoreCLR. They weren't
using Moq for anything important.
2014-11-03 12:38:17 -08:00
Ryan Nowak aae9e67773 add docs 2014-10-31 15:02:54 -07:00
Ryan Nowak d78e5478a7 Fix for #65,116 - Implement 'stack of routers'
This is the routing part of the fix. MVC will be updated as well
(attribute routing).

As the graph of routers is traversed, routers add themselves to the
current 'path', which unwinds on a failed path.

This mechanism is opt-in. Whoever adds something needs to remove it as
part of cleanup. If a router in the tree doesn't interact with the
.Routers property, then there are no consequences for those that do.

Additionally, fixing #116 as part of the same change. This means that we
create a nested 'RouteData' and then restore it on the way out. This is
simpler than just dealing with the .Routers property in isolation.
2014-10-31 14:07:35 -07:00
Kirthi Krishnamraju bc0b61b6f2 Merge branch 'release' into dev 2014-10-29 13:19:43 -07:00
Kirthi Krishnamraju 40b2da7cc7 Added description to project.json 2014-10-29 11:45:42 -07:00
Pranav K b95247d3c4 Merge branch 'release' into dev 2014-10-28 12:36:55 -07:00
Pranav K 0350ca1dba Switching TraceType to Verbose 2014-10-27 16:27:58 -07:00
Pranav K 16725ac0d7 Adding reference to System.Reflection.Extensions 2014-10-24 01:09:02 -07:00
Ryan Nowak db140c9f21 Fix #91 - Make LoggerExtensions public but in an internal namespace 2014-10-22 18:14:05 -07:00
jacalvar 02a0a218b9 [Fixes #90] RouteTemplate does not take RouteData
Changed the implementation of route template to merge the existing route data
with the values obtained from parsing the request path with the given template.

Restored original route data values in case the route template data does not match.
2014-10-22 13:22:11 -07:00
Pranav K e0f01aa6bb Remove unnecessary references from project.json 2014-10-17 17:49:31 -07:00
Stephen Halter fff1d62f01 Change GetService calls to GetRequiredService
GetRequiredService throws for missing services like GetService used to.
2014-10-17 15:31:57 -07:00
Hao Kung 30a4ee1ce1 React to EnsureRoutingServices fix 2014-10-14 21:03:16 -07:00
Hao Kung 86dcbfd0d1 React to options and hosting changes
Uses EnsureRequestServices to force RequestServices to be created
2014-10-14 19:09:15 -07:00
Harsh Gupta 3b19de0e42 Fixing #106 2014-10-14 17:51:15 -07:00
SonjaKhan 2a8ac595d8 Refactoring ILogger, see aspnet/Logging#3 2014-10-14 10:20:58 -07:00
jacalvar 3ff9d6e8a0 [Fixes #108] Disallow the use of '*' in route parameter names 2014-10-13 15:55:02 -07:00
Pranav K e8de0f9d6e Updating System.Text.RegularExpressions version 2014-10-10 14:01:37 -07:00
Pranav K 91a11a9dfe Reacting to CLR package versioning changes 2014-10-10 10:34:07 -07:00
Max Toro fc5f702162 Made GetVirtualPath virtual
For extensibility. This method has always been virtual in MVC and Web API.
2014-10-06 19:21:20 -07:00
Pranav K b15810a173 Reacting to System.Text.Encoding package version change 2014-09-11 10:06:57 -07:00
Chris Ross fbe4da4db9 Handle IBuilder rename to IApplicationBuilder. 2014-09-10 12:44:52 -07:00
David Fowler 4a8de5dad4 Updated to use the new target framework in project.json 2014-09-04 01:50:07 -07:00
David Fowler 81e905cfa9 Updated to use the new target framework in project.json 2014-08-28 23:45:58 -07:00
jacalvar ab7445f59d [Fixes #9] Use a common query string builder api
1. Added a reference to Microsoft.AspNet.WebUtilities.
2. Refactored TemplateBinder to use QueryBuilder instead of
   manually creating a query string.
2014-08-27 10:04:29 -07:00
harshgMSFT 30084b061b Removing stale entry in .kproj 2014-08-15 17:34:34 -07:00
harshgMSFT 70402c8f2c Adding RegexInlineRouteConstraint 2014-08-15 17:32:25 -07:00
David Fowler 966d6dd016 Removed source files from the project 2014-08-15 09:26:26 -07:00
harshgMSFT e12122ec76 Fixing doc comment. 2014-08-13 11:57:56 -07:00
harshgMSFT efdd3054d2 Adding DataTokens Support. 2014-08-11 11:59:00 -07:00
harshgMSFT 5b849596bb Fix for Issue#55 Changing Template->RouteTemplate 2014-08-06 16:14:50 -07:00
Ben Brown fca9831115 Routing Logging
Added scoped logging to RouterMiddleware, RouteCollection, and
TemplateRoute.
2014-08-01 13:59:48 -07:00
Ryan Nowak 61436fb7d1 Revert "Revert "Fix for issue 85 - Dictionary types should return null on key not found""
This is reverting the revert. We're going to go ahead with this change and
work around it in MVC.

This reverts commit 0e826e69e6.
2014-07-31 15:01:03 -07:00
Ryan Nowak 0e826e69e6 Revert "Fix for issue 85 - Dictionary types should return null on key not found"
This is causing issues with routing functional tests in CoreCLR. Suspect
CoreCLR compat issue.

This reverts commit ae65001e84.
2014-07-25 14:35:36 -07:00
Ryan Nowak ae65001e84 Fix for issue 85 - Dictionary types should return null on key not found
This change makes RouteValueDictionary a full IDictionary implementation
instead of a subclass of Dictionary.

Followed the patterns used in the old implementation, namely preserving
the struct-returning behavior of Keys/Values/GetEnumerator.
2014-07-25 13:17:52 -07:00
Ryan Nowak 3eb6c22330 Make RoutePartsEqual public. 2014-07-15 14:25:05 -07:00
Pranav K b9898ef249 Reacting to System.Collections versioning change 2014-07-14 15:54:43 -07:00
Ryan Nowak ad0ebb9f4c cr feedback 2014-07-14 15:31:45 -07:00
David Fowler f696a06012 Renamed configurations to frameworks in project.json 2014-07-13 22:00:44 -07:00
Ryan Nowak 27d6a735af Implement a 'required' constraint
This is useful for a variety of interesting scenarios in link generation
where a default value doesn't appear in the route template as a parameter.

This can be used to implement the desired behavior for areas - where the
'area' key is sticky.
2014-07-08 16:23:14 -07:00
Ryan Nowak 63dcdd6ca5 Fix for #77 - pass ambient values not in the template to constraints
This change adds tests and makes the behavior consistent with legacy MVC
as far as what values are visible in constraints.

This is important because it allows constraints to make decisions based on
whether or not a value is present even if it's not in the template. This
is similar to the behavior of WebAPI link generation or Area link
generation in MVC 5 - but without hardcoding.
2014-07-08 10:18:00 -07:00
tugberkugurlu c6eff50c24 directly return inside the BuilderExtensions.UseRouter method 2014-07-01 10:03:52 +03:00
Brice Lambson a0a0db9856 Bump version to 1.0.0-* 2014-06-19 16:46:05 -07:00
harshgMSFT cef4a3ec05 Removing dictionary overloads from MapRoute. 2014-06-19 14:38:08 -07:00
harshgMSFT fbffcb7b40 Adding Remaining Inline Route Constraints. 2014-06-18 16:29:49 -07:00
harshgMSFT 0ca5576926 StyleCop Fixes for routing. 2014-06-16 11:18:01 -07:00
Pranav K a1fe088d3a Removing RouteContext.RequestPath and calculating it from HttpContext as needed. 2014-06-09 11:18:49 -07:00
harshgMSFT a499d4a92a Routing DI Changes II : Adding services for routing. 2014-06-06 17:08:01 -07:00
Ryan Nowak 28b89c8fe5 Changing to list 2014-06-06 10:16:47 -07:00
Ryan Nowak d10682d15b Issue aspnet/Mvc#56 - merging RouteContext and RequestContext
This is the routing part of these changes, and just the breaking changes
parts.

Follow-ups will add:
- DataTokens
- Tracking the logical stack of routers
2014-06-06 10:11:57 -07:00
Ryan Nowak 1d4ceef81b Turning on warnings as errors for routing 2014-06-04 18:42:41 -07:00
Ryan Nowak 4a51ced5de Fix project file 2014-06-04 13:02:37 -07:00
harshgMSFT 1d3e41560c Routing DI Changes I:
Moving out Default Handler and IInlineConstraintResolver from RouteCollection.
	These are moved to a new interface IRouteBuilder, (instead of an IInlineConstraintResolver, it takes in an IServiceProvider).
	This means all RouteCollectionExtensions are moved to RouteBuilderExtensions.
2014-06-03 16:50:48 -07:00
Ryan Nowak 5616ce0bfa Fix for #36 - IBuilder extension methods should take IRouter 2014-05-30 15:57:40 -07:00
harshgMSFT 5dc8267920 Adding Tests for InlineRouting Support. 2014-05-30 12:56:04 -07:00
harshgMSFT 2e96ba5862 Updating Class and file names according to PR feedback. 2014-05-30 12:40:42 -07:00
harshgMSFT ff3f011ca8 Responding to comments 2014-05-30 12:40:25 -07:00
harshgMSFT 9885830200 Support for InlineConstraints in Route Template 2014-05-30 12:39:25 -07:00
harshgMSFT 187d8e4911 Support for InlineConstraints in Route Template 2014-05-30 12:28:14 -07:00
David Fowler bde341caed Fixed project.json casing 2014-05-26 02:51:56 -07:00
Pranav K d8da964e88 Updating kproj file to match tooling changes 2014-05-18 20:13:56 -07:00
Andrew Peters feb150570a Updating copyright headers 2014-05-08 23:01:29 -07:00
Wei Wang 96568362ea Sort dependencies and remove duplicates in dependencies 2014-05-07 17:47:44 -07:00
Chris Ross 7a855ba626 Remove unused DI dependency. 2014-05-06 11:25:54 -07:00
David Fowler b0dc6c95f8 React to more renames 2014-05-06 00:22:55 -07:00
Ryan Nowak 8fcddc12e7 Incorporate name changes 2014-05-05 16:54:45 -07:00
Ryan Nowak dfd4ba4b1b Fixing routing for package changes in reflection 2014-05-05 10:24:29 -07:00
anpete 51317a7039 Update file headers 2014-05-01 17:41:33 -07:00
harshgMSFT 950ce56ea5 Adding Support for NamedRoutes.
- Interface Changes.
- RouteCollectionExtensions
- Tests for Named Routes
2014-04-30 11:23:54 -07:00
David Fowler f86877b14f Move BuilderExtensions and RouterMiddleware to Microsoft.AspNet 2014-04-18 00:22:27 -07:00
Ryan Nowak 06c63c38a1 Fix for #32 and #33 - return IBuilder from UseRouter
Also removing the overload that doesn't take a route collection
2014-04-16 20:01:35 -07:00
David Fowler 23c11bc950 Updated to use the new tooling 2014-04-08 01:37:06 -07:00
Ryan Nowak 87a47f50cc Passing more data to on GetVirtualPath
For link generation to areas, we need to provide the set of values that
the route could potentially provide.

Basically if we know what action we want to reach, we want to know whether
or not a given route could hit that action before giving it the OK to
generate a link.

For instance a route like '{controller}' couldn't hit an action like
'HomeController:DoACoolThing', since it can never provide a value for
'action'. This makes it possible for WebFX to make the right decision
without changing the behavior of any of the routing constructs. This also
has the side-effect of removing a class of order dependencies in routing
that cause bad links to be generated.
2014-03-31 12:05:47 -07:00
Yishai Galatzer cd0528b1b2 Link generation related tests 2014-03-31 09:31:49 -07:00
Yishai Galatzer 77ef7a5cde RouteConstraints Step II + III
Include Url Generation support
Add unit tests
Clean issues found by unit tests
2014-03-31 09:31:48 -07:00
David Fowler 2b87a625d9 Updated clr packages 2014-03-29 01:15:28 -07:00
Pranav K 6ff5ebafd2 Updating CoreCLR package versions 2014-03-27 17:30:36 -07:00
Yishai Galatzer db7b36a859 Fix merge errors 2014-03-27 11:01:04 -07:00
Yishai Galatzer 70e26a80ad CR Feedback 2014-03-27 10:58:15 -07:00
Yishai Galatzer a917cbd577 Constraints 2014-03-27 10:58:14 -07:00
Ryan Nowak cf16d6cba7 Small refactor of TemplateBinder
We'll need to access the accepted values to do proper link generation, so
separating this process out into 2 parts.

Also moving defaults into the TemplateBinder because they are conceptually
part of the route, not part of the request. I'll do the same for
TemplateMatcher soon, but it's a big change and worth separating.
2014-03-26 18:44:57 -07:00
Ryan Nowak ea8f19f186 CR feedback 2014-03-11 11:20:33 -07:00
Ryan Nowak 6a309f20d8 Passing route collection through the context - for MVC to get access to it. 2014-03-10 10:12:19 -07:00
Ryan Nowak da057820e5 Rename BindPath (CR Feedback) 2014-03-10 10:02:57 -07:00
David Fowler f5a43708ee Added references to required K packages 2014-03-07 02:28:46 -08:00
Ryan Nowak 83eb6c4d22 Small bugfix in routing 2014-03-06 16:23:48 -08:00
Ryan Nowak f604fb8d87 CR feedback again 2014-03-06 12:18:31 -08:00