Permalink
Browse files

Cleaned up http method attributes (all in core now)

  • Loading branch information...
1 parent edb5f37 commit 74f55837ead097602a8b1a71ad8e3ba430ed77d8 @kamranayub committed Apr 8, 2012
Showing with 36 additions and 199 deletions.
  1. +1 −0 src/AttributeRouting.Specs/Subjects/BugFixesController.cs
  2. +1 −1 src/AttributeRouting.Specs/Subjects/Http/StandardUsageController.cs
  3. +1 −0 src/AttributeRouting.Specs/Subjects/LocalizationControllers.cs
  4. +1 −0 src/AttributeRouting.Specs/Subjects/LowercaseUrlController.cs
  5. +1 −0 src/AttributeRouting.Specs/Subjects/RouteAreasControllers.cs
  6. +1 −0 src/AttributeRouting.Specs/Subjects/RouteConventionsController.cs
  7. +1 −0 src/AttributeRouting.Specs/Subjects/RouteDefaultsController.cs
  8. +1 −0 src/AttributeRouting.Specs/Subjects/RoutePrecedenceController.cs
  9. +1 −0 src/AttributeRouting.Specs/Subjects/RoutePrefixesControllers.cs
  10. +1 −0 src/AttributeRouting.Specs/Subjects/StandardUsageController.cs
  11. +1 −0 src/AttributeRouting.Specs/Subjects/SubdomainControllers.cs
  12. +1 −0 src/AttributeRouting.Tests.Web/Areas/Admin/Controllers/HomeController.cs
  13. +1 −0 src/AttributeRouting.Tests.Web/Areas/Admin/Controllers/UsersController.cs
  14. +1 −0 src/AttributeRouting.Tests.Web/Controllers/AccountController.cs
  15. +1 −0 src/AttributeRouting.Tests.Web/Controllers/ControllerBase.cs
  16. +1 −0 src/AttributeRouting.Tests.Web/Controllers/DangerController.cs
  17. +1 −0 src/AttributeRouting.Tests.Web/Controllers/HomeController.cs
  18. +1 −0 src/AttributeRouting.Tests.Web/Controllers/LocalizationController.cs
  19. +1 −0 src/AttributeRouting.Tests.Web/Controllers/NestedController.cs
  20. +1 −0 src/AttributeRouting.Tests.Web/Controllers/RenderActionController.cs
  21. +1 −0 src/AttributeRouting.Tests.Web/Controllers/RestfulController.cs
  22. +0 −8 src/AttributeRouting.Web.Http/AttributeRouting.Web.Http.csproj
  23. +0 −9 src/AttributeRouting.Web.Http/DELETEAttribute.cs
  24. +1 −1 src/AttributeRouting.Web.Http/DefaultHttpRouteConventionAttribute.cs
  25. +0 −7 src/AttributeRouting.Web.Http/GETAttribute.cs
  26. +0 −45 src/AttributeRouting.Web.Http/HttpConventionAttribute.cs
  27. +0 −52 src/AttributeRouting.Web.Http/HttpRouteAttribute.cs
  28. +0 −10 src/AttributeRouting.Web.Http/OPTIONSAttribute.cs
  29. +0 −10 src/AttributeRouting.Web.Http/POSTAttribute.cs
  30. +0 −7 src/AttributeRouting.Web.Http/PUTAttribute.cs
  31. +0 −10 src/AttributeRouting.Web.Http/TRACEAttribute.cs
  32. +0 −6 src/AttributeRouting.Web.Mvc/AttributeRouting.Web.Mvc.csproj
  33. +7 −1 src/AttributeRouting/AttributeRouting.csproj
  34. +1 −1 src/{AttributeRouting.Web.Mvc → AttributeRouting}/DELETEAttribute.cs
  35. +1 −1 src/{AttributeRouting.Web.Mvc → AttributeRouting}/GETAttribute.cs
  36. +1 −1 src/{AttributeRouting.Web.Mvc → AttributeRouting}/POSTAttribute.cs
  37. +1 −1 src/{AttributeRouting.Web.Mvc → AttributeRouting}/PUTAttribute.cs
  38. +2 −26 src/{AttributeRouting.Web.Mvc → AttributeRouting}/RouteAttribute.cs
  39. +1 −2 src/{AttributeRouting.Web.Mvc → AttributeRouting}/RouteConventionAttribute.cs
@@ -1,5 +1,6 @@
using System;
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -36,7 +36,7 @@ public string Wildcards()
return "";
}
- [HttpRoute("api/AnyVerb")]
+ [Route("api/AnyVerb")]
public string AnyVerb()
{
return "";
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Specs.Subjects
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Areas.Admin.Controllers
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Areas.Admin.Controllers
@@ -3,6 +3,7 @@
using System.Web.Routing;
using System.Web.Security;
using AttributeRouting.Tests.Web.Models;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Controllers
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Controllers
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Controllers
@@ -1,5 +1,6 @@
using System.Net;
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Controllers
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Controllers
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Controllers
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Controllers
@@ -1,4 +1,5 @@
using System.Web.Mvc;
+using AttributeRouting.Web;
using AttributeRouting.Web.Mvc;
namespace AttributeRouting.Tests.Web.Controllers
@@ -70,15 +70,7 @@
<Link>SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="DefaultHttpRouteConventionAttribute.cs" />
- <Compile Include="DELETEAttribute.cs" />
- <Compile Include="GETAttribute.cs" />
- <Compile Include="HttpConventionAttribute.cs" />
- <Compile Include="HttpRouteAttribute.cs" />
- <Compile Include="OPTIONSAttribute.cs" />
- <Compile Include="POSTAttribute.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="PUTAttribute.cs" />
- <Compile Include="TRACEAttribute.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AttributeRouting\AttributeRouting.csproj">
@@ -1,9 +0,0 @@
-namespace AttributeRouting.Web.Http {
- public class DELETEAttribute : HttpRouteAttribute {
- public DELETEAttribute(string routeUrl)
- : base(routeUrl, "DELETE")
- {
-
- }
- }
-}
@@ -12,7 +12,7 @@ namespace AttributeRouting.Web.Http
/// Sets up the default Web API route convention
/// See: http://www.asp.net/web-api/overview/web-api-routing-and-actions/routing-in-aspnet-web-api
/// </summary>
- public class DefaultHttpRouteConventionAttribute : HttpConventionAttribute
+ public class DefaultHttpRouteConventionAttribute : RouteConventionAttribute
{
// Setup conventions
private static readonly List<HttpRouteConventionInfo> Conventions = new List<HttpRouteConventionInfo>
@@ -1,7 +0,0 @@
-namespace AttributeRouting.Web.Http
-{
- public class GETAttribute : HttpRouteAttribute {
- public GETAttribute(string routeUrl)
- : base(routeUrl, "GET", "HEAD") { }
- }
-}
@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using AttributeRouting.Constraints;
-
-namespace AttributeRouting.Web.Http
-{
- /// <summary>
- /// Base class for HttpConventionAttributes
- /// </summary>
- public abstract class HttpConventionAttribute : Attribute, IRouteConvention
- {
- /// <summary>
- /// Gets the RouteAttributes to be applied to the given action method.
- /// </summary>
- /// <param name="actionMethod"></param>
- /// <returns></returns>
- public abstract IEnumerable<IRouteAttribute> GetRouteAttributes(MethodInfo actionMethod);
-
- /// <summary>
- /// Gets the default route prefix to use if no RoutePrefix is applied on the controller.
- /// </summary>
- /// <param name="actionMethod"></param>
- /// <returns></returns>
- public virtual string GetDefaultRoutePrefix(MethodInfo actionMethod)
- {
- return "";
- }
-
- /// <summary>
- /// Gets the route defaults to be applied against the given action method.
- /// </summary>
- /// <param name="actionMethod"></param>
- /// <returns></returns>
- public virtual IEnumerable<RouteDefaultAttribute> GetRouteDefaultAttributes(MethodInfo actionMethod)
- {
- yield break;
- }
-
- public virtual IEnumerable<IAttributeRouteConstraint> GetRouteConstraintAttributes(MethodInfo actionMethod)
- {
- yield break;
- }
- }
-}
@@ -1,52 +0,0 @@
-using System;
-
-namespace AttributeRouting.Web.Http
-{
- [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
- public class HttpRouteAttribute : Attribute, IRouteAttribute
- {
- public HttpRouteAttribute(string routeUrl, params string[] allowedMethods) {
- if (routeUrl == null) throw new ArgumentNullException("routeUrl");
-
- RouteUrl = routeUrl;
- HttpMethods = allowedMethods;
- Order = int.MaxValue;
- Precedence = int.MaxValue;
- }
-
- /// <summary>
- /// The HttpMethods this route is constrained against.
- /// </summary>
- public string[] HttpMethods { get; private set; }
-
- /// <summary>
- /// The url for this action.
- /// </summary>
- public string RouteUrl { get; private set; }
-
- /// <summary>
- /// The order of this route among all the routes defined against this action.
- /// </summary>
- public int Order { get; set; }
-
- /// <summary>
- /// The order of this route among all the routes defined against this controller.
- /// </summary>
- public int Precedence { get; set; }
-
- /// <summary>
- /// The name this route will be registered with in the RouteTable.
- /// </summary>
- public string RouteName { get; set; }
-
- /// <summary>
- /// If true, the generated route url will be applied from the root, skipping any relevant area name or route prefix.
- /// </summary>
- public bool IsAbsoluteUrl { get; set; }
-
- /// <summary>
- /// Key used by translation provider to lookup the translation for the <see cref="RouteUrl"/>.
- /// </summary>
- public string TranslationKey { get; set; }
- }
-}
@@ -1,10 +0,0 @@
-namespace AttributeRouting.Web.Http
-{
- public class OPTIONSAttribute : HttpRouteAttribute {
- public OPTIONSAttribute(string routeUrl)
- : base(routeUrl, "OPTIONS")
- {
-
- }
- }
-}
@@ -1,10 +0,0 @@
-namespace AttributeRouting.Web.Http
-{
- public class POSTAttribute : HttpRouteAttribute {
- public POSTAttribute(string routeUrl)
- : base(routeUrl, "POST")
- {
-
- }
- }
-}
@@ -1,7 +0,0 @@
-namespace AttributeRouting.Web.Http
-{
- public class PUTAttribute : HttpRouteAttribute {
- public PUTAttribute(string routeUrl)
- : base(routeUrl, "PUT") { }
- }
-}
@@ -1,10 +0,0 @@
-namespace AttributeRouting.Web.Http
-{
- public class TRACEAttribute : HttpRouteAttribute {
- public TRACEAttribute(string routeUrl)
- : base(routeUrl, "TRACE")
- {
-
- }
- }
-}
@@ -50,17 +50,11 @@
<Link>SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="AttributeRoutingConfiguration.cs" />
- <Compile Include="DELETEAttribute.cs" />
<Compile Include="Framework\Factories\MvcAttributeRouteFactory.cs" />
<Compile Include="Framework\Factories\UrlParameterFactory.cs" />
- <Compile Include="GETAttribute.cs" />
- <Compile Include="POSTAttribute.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="PUTAttribute.cs" />
<Compile Include="RestfulRouteConventionAttribute.cs" />
- <Compile Include="RouteAttribute.cs" />
<Compile Include="RouteCollectionExtensions.cs" />
- <Compile Include="RouteConventionAttribute.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AttributeRouting.Web\AttributeRouting.Web.csproj">
@@ -56,15 +56,18 @@
<Link>SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="AreaConfiguration.cs" />
+ <Compile Include="AttributeRoutingConfigurationBase.cs" />
<Compile Include="Constraints\IRegexRouteConstraint.cs" />
<Compile Include="Constraints\IRestfulHttpMethodConstraint.cs" />
<Compile Include="Constraints\IAttributeRouteConstraint.cs" />
<Compile Include="Constraints\RegexRouteConstraintBase.cs" />
+ <Compile Include="DELETEAttribute.cs" />
<Compile Include="Framework\Factories\IAttributeRouteFactory.cs" />
<Compile Include="Framework\Factories\IConstraintFactory.cs" />
<Compile Include="Framework\Factories\IParameterFactory.cs" />
<Compile Include="Framework\IAttributeRoute.cs" />
<Compile Include="Framework\Localization\ControllerTranslationBuilder.cs" />
+ <Compile Include="GETAttribute.cs" />
<Compile Include="Helpers\ExpressionHelper.cs" />
<Compile Include="Helpers\ObjectExtensions.cs" />
<Compile Include="Helpers\ReflectionExtensions.cs" />
@@ -80,11 +83,14 @@
<Compile Include="IRouteConvention.cs" />
<Compile Include="Logging\AttributeRouteInfo.cs" />
<Compile Include="Logging\LogWriter.cs" />
+ <Compile Include="POSTAttribute.cs" />
+ <Compile Include="PUTAttribute.cs" />
+ <Compile Include="RouteAttribute.cs" />
<Compile Include="RouteConstraintAttributeBase.cs" />
+ <Compile Include="RouteConventionAttribute.cs" />
<Compile Include="RoutePrefixAttribute.cs" />
<Compile Include="RouteAreaAttribute.cs" />
<Compile Include="RouteDefaultAttribute.cs" />
- <Compile Include="AttributeRoutingConfiguration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Framework\RouteSpecification.cs" />
<Compile Include="Framework\RouteReflector.cs" />
@@ -1,4 +1,4 @@
-namespace AttributeRouting.Web.Mvc
+namespace AttributeRouting
{
/// <summary>
/// Defines a route for an action constrained to requests providing an httpMethod value of DELETE.
@@ -1,4 +1,4 @@
-namespace AttributeRouting.Web.Mvc
+namespace AttributeRouting
{
/// <summary>
/// Defines a route for an action constrained to requests providing an httpMethod value of GET.
@@ -1,4 +1,4 @@
-namespace AttributeRouting.Web.Mvc
+namespace AttributeRouting
{
/// <summary>
/// Defines a route for an action constrained to requests providing an httpMethod value of POST.
@@ -1,4 +1,4 @@
-namespace AttributeRouting.Web.Mvc
+namespace AttributeRouting
{
/// <summary>
/// Defines a route for an action constrained to requests providing an httpMethod value of PUT.
Oops, something went wrong.

0 comments on commit 74f5583

Please sign in to comment.