Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.Framework / Attributes / AccessibleThroughAttribute.cs
blobc175fa803cec5100fd8d7a860b299c92929ded28
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Framework
17 using System;
19 /// <summary>
20 /// Enum to identify a http verb
21 /// </summary>
22 public enum Verb
24 /// <summary>
25 /// The GET method means retrieve whatever information is identified by the Request-URI.
26 /// <remarks>
27 /// The convention has been established that the GET method SHOULD
28 /// NOT have the significance of taking an action other than retrieval.
29 /// </remarks>
30 /// </summary>
31 Get = 0,
32 /// <summary>
33 /// The POST method is used to request that the origin server accept the entity
34 /// enclosed in the request as a new subordinate of the resource identified by the
35 /// Request-URI in the Request-Line.
36 /// <remarks>
37 /// The convention has been established that the POST method will
38 /// take an action other than just retrieval.
39 /// </remarks>
40 /// </summary>
41 Post = 1,
44 /// <summary>
45 /// Decorates an action with a restriction to the HTTP method
46 /// that is allowed to request it.
47 /// </summary>
48 [AttributeUsage(AttributeTargets.Method), Serializable]
49 public class AccessibleThroughAttribute : Attribute
51 private readonly Verb verb;
53 /// <summary>
54 /// Constructs a AccessibleThroughAttribute with
55 /// the specified <paramref name="verb"/>.
56 /// </summary>
57 /// <param name="verb">The <see cref="Verb"/> to allow for this action.</param>
58 public AccessibleThroughAttribute(Verb verb)
60 this.verb = verb;
63 /// <summary>
64 /// The Verb to allow.
65 /// </summary>
66 public Verb Verb
68 get { return verb; }