Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/aspnetwebstack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhalid Abuhakmeh <khalid@aquabirdconsulting.com>2012-03-28 05:18:56 +0400
committermarcind <marcind@microsoft.com>2012-04-03 07:45:00 +0400
commit78bc211245bdf4d537c72acc2b354cf8766031af (patch)
tree56cd5cf28320f2f29134339f6a429a1f25e3c945 /src/System.Web.Mvc
parent6e7594781f71bb3594a0d32f99dba025f156b400 (diff)
added PATCH (issue #3) and OPTIONS (issue #6) as a valid HttpVerb and created corresponding filter attributes.
Diffstat (limited to 'src/System.Web.Mvc')
-rw-r--r--src/System.Web.Mvc/AcceptVerbsAttribute.cs2
-rw-r--r--src/System.Web.Mvc/HtmlHelper.cs6
-rw-r--r--src/System.Web.Mvc/HttpOptionsAttribute.cs15
-rw-r--r--src/System.Web.Mvc/HttpPatchAttribute.cs15
-rw-r--r--src/System.Web.Mvc/HttpVerbs.cs4
-rw-r--r--src/System.Web.Mvc/Properties/MvcResources.Designer.cs4
-rw-r--r--src/System.Web.Mvc/Properties/MvcResources.resx2
-rw-r--r--src/System.Web.Mvc/System.Web.Mvc.csproj2
8 files changed, 46 insertions, 4 deletions
diff --git a/src/System.Web.Mvc/AcceptVerbsAttribute.cs b/src/System.Web.Mvc/AcceptVerbsAttribute.cs
index 1783cdfe..7f53f9ed 100644
--- a/src/System.Web.Mvc/AcceptVerbsAttribute.cs
+++ b/src/System.Web.Mvc/AcceptVerbsAttribute.cs
@@ -45,6 +45,8 @@ namespace System.Web.Mvc
AddEntryToList(verbs, HttpVerbs.Put, verbList, "PUT");
AddEntryToList(verbs, HttpVerbs.Delete, verbList, "DELETE");
AddEntryToList(verbs, HttpVerbs.Head, verbList, "HEAD");
+ AddEntryToList(verbs, HttpVerbs.Patch, verbList, "PATCH");
+ AddEntryToList(verbs, HttpVerbs.Options, verbList, "OPTIONS");
return verbList.ToArray();
}
diff --git a/src/System.Web.Mvc/HtmlHelper.cs b/src/System.Web.Mvc/HtmlHelper.cs
index c6ab7021..d9a5d2d0 100644
--- a/src/System.Web.Mvc/HtmlHelper.cs
+++ b/src/System.Web.Mvc/HtmlHelper.cs
@@ -359,6 +359,12 @@ namespace System.Web.Mvc
case HttpVerbs.Put:
httpMethod = "PUT";
break;
+ case HttpVerbs.Patch:
+ httpMethod = "PATCH";
+ break;
+ case HttpVerbs.Options:
+ httpMethod = "OPTIONS";
+ break;
default:
throw new ArgumentException(MvcResources.HtmlHelper_InvalidHttpVerb, "httpVerb");
}
diff --git a/src/System.Web.Mvc/HttpOptionsAttribute.cs b/src/System.Web.Mvc/HttpOptionsAttribute.cs
new file mode 100644
index 00000000..8ba16155
--- /dev/null
+++ b/src/System.Web.Mvc/HttpOptionsAttribute.cs
@@ -0,0 +1,15 @@
+using System.Reflection;
+
+namespace System.Web.Mvc
+{
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+ public sealed class HttpOptionsAttribute : ActionMethodSelectorAttribute
+ {
+ private static readonly AcceptVerbsAttribute _innerAttribute = new AcceptVerbsAttribute(HttpVerbs.Options);
+
+ public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
+ {
+ return _innerAttribute.IsValidForRequest(controllerContext, methodInfo);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Web.Mvc/HttpPatchAttribute.cs b/src/System.Web.Mvc/HttpPatchAttribute.cs
new file mode 100644
index 00000000..6f7d9252
--- /dev/null
+++ b/src/System.Web.Mvc/HttpPatchAttribute.cs
@@ -0,0 +1,15 @@
+using System.Reflection;
+
+namespace System.Web.Mvc
+{
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+ public sealed class HttpPatchAttribute : ActionMethodSelectorAttribute
+ {
+ private static readonly AcceptVerbsAttribute _innerAttribute = new AcceptVerbsAttribute(HttpVerbs.Patch);
+
+ public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
+ {
+ return _innerAttribute.IsValidForRequest(controllerContext, methodInfo);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Web.Mvc/HttpVerbs.cs b/src/System.Web.Mvc/HttpVerbs.cs
index 22049977..debd7824 100644
--- a/src/System.Web.Mvc/HttpVerbs.cs
+++ b/src/System.Web.Mvc/HttpVerbs.cs
@@ -7,6 +7,8 @@
Post = 1 << 1,
Put = 1 << 2,
Delete = 1 << 3,
- Head = 1 << 4
+ Head = 1 << 4,
+ Patch = 1 << 5,
+ Options = 1 << 6,
}
}
diff --git a/src/System.Web.Mvc/Properties/MvcResources.Designer.cs b/src/System.Web.Mvc/Properties/MvcResources.Designer.cs
index 0618068e..b1db5533 100644
--- a/src/System.Web.Mvc/Properties/MvcResources.Designer.cs
+++ b/src/System.Web.Mvc/Properties/MvcResources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.17369
+// Runtime Version:4.0.30319.530
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -542,7 +542,7 @@ namespace System.Web.Mvc.Properties {
}
/// <summary>
- /// Looks up a localized string similar to The specified HttpVerbs value is not supported. The supported values are Delete, Head, and Put..
+ /// Looks up a localized string similar to The specified HttpVerbs value is not supported. The supported values are Delete, Head, Put, Options, and Patch..
/// </summary>
internal static string HtmlHelper_InvalidHttpVerb {
get {
diff --git a/src/System.Web.Mvc/Properties/MvcResources.resx b/src/System.Web.Mvc/Properties/MvcResources.resx
index 5bcc68f5..0189143a 100644
--- a/src/System.Web.Mvc/Properties/MvcResources.resx
+++ b/src/System.Web.Mvc/Properties/MvcResources.resx
@@ -277,7 +277,7 @@
<value>The requested resource can only be accessed via SSL.</value>
</data>
<data name="HtmlHelper_InvalidHttpVerb" xml:space="preserve">
- <value>The specified HttpVerbs value is not supported. The supported values are Delete, Head, and Put.</value>
+ <value>The specified HttpVerbs value is not supported. The supported values are Delete, Head, Put, Options, and Patch.</value>
</data>
<data name="HtmlHelper_InvalidHttpMethod" xml:space="preserve">
<value>The GET and POST HTTP methods are not supported.</value>
diff --git a/src/System.Web.Mvc/System.Web.Mvc.csproj b/src/System.Web.Mvc/System.Web.Mvc.csproj
index b1eb3c0c..632fd4d9 100644
--- a/src/System.Web.Mvc/System.Web.Mvc.csproj
+++ b/src/System.Web.Mvc/System.Web.Mvc.csproj
@@ -96,6 +96,8 @@
<Compile Include="ChildActionValueProvider.cs" />
<Compile Include="ChildActionValueProviderFactory.cs" />
<Compile Include="HttpHeadAttribute.cs" />
+ <Compile Include="HttpOptionsAttribute.cs" />
+ <Compile Include="HttpPatchAttribute.cs" />
<Compile Include="IEnumerableValueProvider.cs" />
<Compile Include="DataTypeUtil.cs" />
<Compile Include="Html\DisplayNameExtensions.cs" />