* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / HttpRuntimeSection.cs
1 //
2 // System.Web.Configuration.HttpRuntimeSection
3 //
4 // Authors:
5 //      Chris Toshok (toshok@ximian.com)
6 //
7 // (C) 2005 Novell, Inc (http://www.novell.com)
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 #if NET_2_0
32
33 using System;
34 using System.ComponentModel;
35 using System.Configuration;
36
37 namespace System.Web.Configuration
38 {
39         public sealed class HttpRuntimeSection : ConfigurationSection
40         {
41                 static ConfigurationProperty apartmentThreadingProp;
42                 static ConfigurationProperty appRequestQueueLimitProp;
43                 static ConfigurationProperty delayNotificationTimeoutProp;
44                 static ConfigurationProperty enableProp;
45                 static ConfigurationProperty enableHeaderCheckingProp;
46                 static ConfigurationProperty enableKernelOutputCacheProp;
47                 static ConfigurationProperty enableVersionHeaderProp;
48                 static ConfigurationProperty executionTimeoutProp;
49                 static ConfigurationProperty maxRequestLengthProp;
50                 static ConfigurationProperty maxWaitChangeNotificationProp;
51                 static ConfigurationProperty minFreeThreadsProp;
52                 static ConfigurationProperty minLocalRequestFreeThreadsProp;
53                 static ConfigurationProperty requestLengthDiskThresholdProp;
54                 static ConfigurationProperty requireRootedSaveAsPathProp;
55                 static ConfigurationProperty sendCacheControlHeaderProp;
56                 static ConfigurationProperty shutdownTimeoutProp;
57                 static ConfigurationProperty useFullyQualifiedRedirectUrlProp;
58                 static ConfigurationProperty waitChangeNotificationProp;
59                 static ConfigurationPropertyCollection properties;
60
61                 static HttpRuntimeSection ()
62                 {
63                         apartmentThreadingProp = new ConfigurationProperty ("apartmentThreading", typeof (bool), false);
64                         appRequestQueueLimitProp = new ConfigurationProperty ("appRequestQueueLimit", typeof (int), 5000,
65                                                                               TypeDescriptor.GetConverter (typeof (int)),
66                                                                               new IntegerValidator (1, Int32.MaxValue),
67                                                                               ConfigurationPropertyOptions.None);
68                         delayNotificationTimeoutProp = new ConfigurationProperty ("delayNotificationTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (5),
69                                                                                   PropertyHelper.TimeSpanSecondsConverter,
70                                                                                   PropertyHelper.DefaultValidator,
71                                                                                   ConfigurationPropertyOptions.None);
72                         enableProp = new ConfigurationProperty ("enable", typeof (bool), true);
73                         enableHeaderCheckingProp = new ConfigurationProperty ("enableHeaderChecking", typeof (bool), true);
74                         enableKernelOutputCacheProp = new ConfigurationProperty ("enableKernelOutputCache", typeof (bool), true);
75                         enableVersionHeaderProp = new ConfigurationProperty ("enableVersionHeader", typeof (bool), true);
76                         executionTimeoutProp = new ConfigurationProperty ("executionTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (110),
77                                                                           PropertyHelper.TimeSpanSecondsConverter,
78                                                                           PropertyHelper.PositiveTimeSpanValidator,
79                                                                           ConfigurationPropertyOptions.None);
80                         maxRequestLengthProp = new ConfigurationProperty ("maxRequestLength", typeof (int), 4096,
81                                                                           TypeDescriptor.GetConverter (typeof (int)),
82                                                                           PropertyHelper.IntFromZeroToMaxValidator,
83                                                                           ConfigurationPropertyOptions.None);
84                         maxWaitChangeNotificationProp = new ConfigurationProperty ("maxWaitChangeNotification", typeof (int), 0,
85                                                                                    TypeDescriptor.GetConverter (typeof (int)),
86                                                                                    PropertyHelper.IntFromZeroToMaxValidator,
87                                                                                    ConfigurationPropertyOptions.None);
88                         minFreeThreadsProp = new ConfigurationProperty ("minFreeThreads", typeof (int), 8,
89                                                                         TypeDescriptor.GetConverter (typeof (int)),
90                                                                         PropertyHelper.IntFromZeroToMaxValidator,
91                                                                         ConfigurationPropertyOptions.None);
92                         minLocalRequestFreeThreadsProp = new ConfigurationProperty ("minLocalRequestFreeThreads", typeof (int), 4,
93                                                                                     TypeDescriptor.GetConverter (typeof (int)),
94                                                                                     PropertyHelper.IntFromZeroToMaxValidator,
95                                                                                     ConfigurationPropertyOptions.None);
96                         requestLengthDiskThresholdProp = new ConfigurationProperty ("requestLengthDiskThreshold", typeof (int), 80,
97                                                                                     TypeDescriptor.GetConverter (typeof (int)),
98                                                                                     new IntegerValidator (1, Int32.MaxValue),
99                                                                                     ConfigurationPropertyOptions.None);
100                         requireRootedSaveAsPathProp = new ConfigurationProperty ("requireRootedSaveAsPath", typeof (bool), true);
101                         sendCacheControlHeaderProp = new ConfigurationProperty ("sendCacheControlHeader", typeof (bool), true);
102                         shutdownTimeoutProp = new ConfigurationProperty ("shutdownTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (90),
103                                                                          PropertyHelper.TimeSpanSecondsConverter,
104                                                                          PropertyHelper.DefaultValidator,
105                                                                          ConfigurationPropertyOptions.None);
106                         useFullyQualifiedRedirectUrlProp = new ConfigurationProperty ("useFullyQualifiedRedirectUrl", typeof (bool), false);
107                         waitChangeNotificationProp = new ConfigurationProperty ("waitChangeNotification", typeof (int), 0,
108                                                                                 TypeDescriptor.GetConverter (typeof (int)),
109                                                                                 PropertyHelper.IntFromZeroToMaxValidator,
110                                                                                 ConfigurationPropertyOptions.None);
111
112                         properties = new ConfigurationPropertyCollection();
113                         properties.Add (apartmentThreadingProp);
114                         properties.Add (appRequestQueueLimitProp);
115                         properties.Add (delayNotificationTimeoutProp);
116                         properties.Add (enableProp);
117                         properties.Add (enableHeaderCheckingProp);
118                         properties.Add (enableKernelOutputCacheProp);
119                         properties.Add (enableVersionHeaderProp);
120                         properties.Add (executionTimeoutProp);
121                         properties.Add (maxRequestLengthProp);
122                         properties.Add (maxWaitChangeNotificationProp);
123                         properties.Add (minFreeThreadsProp);
124                         properties.Add (minLocalRequestFreeThreadsProp);
125                         properties.Add (requestLengthDiskThresholdProp);
126                         properties.Add (requireRootedSaveAsPathProp);
127                         properties.Add (sendCacheControlHeaderProp);
128                         properties.Add (shutdownTimeoutProp);
129                         properties.Add (useFullyQualifiedRedirectUrlProp);
130                         properties.Add (waitChangeNotificationProp);
131                 }
132
133                 public HttpRuntimeSection()
134                 {
135                 }
136
137                 [ConfigurationProperty ("apartmentThreading", DefaultValue = "False")]
138                 public bool ApartmentThreading {
139                         get { return (bool) base[apartmentThreadingProp]; }
140                         set { base[apartmentThreadingProp] = value; }
141                 }
142
143                 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue)]
144                 [ConfigurationProperty ("appRequestQueueLimit", DefaultValue = "5000")]
145                 public int AppRequestQueueLimit {
146                         get { return (int) base[appRequestQueueLimitProp]; }
147                         set { base[appRequestQueueLimitProp] = value; }
148                 }
149
150                 [TypeConverter (typeof (TimeSpanSecondsConverter))]
151                 [ConfigurationProperty ("delayNotificationTimeout", DefaultValue = "00:00:05")]
152                 public TimeSpan DelayNotificationTimeout {
153                         get { return (TimeSpan) base[delayNotificationTimeoutProp]; }
154                         set { base[delayNotificationTimeoutProp] = value; }
155                 }
156
157                 [ConfigurationProperty ("enable", DefaultValue = "True")]
158                 public bool Enable {
159                         get { return (bool) base[enableProp]; }
160                         set { base[enableProp] = value; }
161                 }
162
163                 [ConfigurationProperty ("enableHeaderChecking", DefaultValue = "True")]
164                 public bool EnableHeaderChecking {
165                         get { return (bool) base[enableHeaderCheckingProp]; }
166                         set { base[enableHeaderCheckingProp] = value; }
167                 }
168
169                 [ConfigurationProperty ("enableKernelOutputCache", DefaultValue = "True")]
170                 public bool EnableKernelOutputCache {
171                         get { return (bool) base[enableKernelOutputCacheProp]; }
172                         set { base[enableKernelOutputCacheProp] = value; }
173                 }
174
175                 [ConfigurationProperty ("enableVersionHeader", DefaultValue = "True")]
176                 public bool EnableVersionHeader {
177                         get { return (bool) base[enableVersionHeaderProp]; }
178                         set { base[enableVersionHeaderProp] = value; }
179                 }
180
181                 [TypeConverter (typeof (TimeSpanSecondsConverter))]
182                 [TimeSpanValidator (MinValueString = "00:00:00")]
183                 [ConfigurationProperty ("executionTimeout", DefaultValue = "00:01:50")]
184                 public TimeSpan ExecutionTimeout {
185                         get { return (TimeSpan) base[executionTimeoutProp]; }
186                         set { base[executionTimeoutProp] = value; }
187                 }
188
189                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
190                 [ConfigurationProperty ("maxRequestLength", DefaultValue = "4096")]
191                 public int MaxRequestLength {
192                         get { return (int) base[maxRequestLengthProp]; }
193                         set { base[maxRequestLengthProp] = value; }
194                 }
195
196                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
197                 [ConfigurationProperty ("maxWaitChangeNotification", DefaultValue = "0")]
198                 public int MaxWaitChangeNotification {
199                         get { return (int) base[maxWaitChangeNotificationProp]; }
200                         set { base[maxWaitChangeNotificationProp] = value; }
201                 }
202
203                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
204                 [ConfigurationProperty ("minFreeThreads", DefaultValue = "8")]
205                 public int MinFreeThreads {
206                         get { return (int) base[minFreeThreadsProp]; }
207                         set { base[minFreeThreadsProp] = value; }
208                 }
209
210                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
211                 [ConfigurationProperty ("minLocalRequestFreeThreads", DefaultValue = "4")]
212                 public int MinLocalRequestFreeThreads {
213                         get { return (int) base[minLocalRequestFreeThreadsProp]; }
214                         set { base[minLocalRequestFreeThreadsProp] = value; }
215                 }
216
217                 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue)]
218                 [ConfigurationProperty ("requestLengthDiskThreshold", DefaultValue = "80")]
219                 public int RequestLengthDiskThreshold {
220                         get { return (int) base[requestLengthDiskThresholdProp]; }
221                         set { base[requestLengthDiskThresholdProp] = value; }
222                 }
223
224                 [ConfigurationProperty ("requireRootedSaveAsPath", DefaultValue = "True")]
225                 public bool RequireRootedSaveAsPath {
226                         get { return (bool) base[requireRootedSaveAsPathProp]; }
227                         set { base[requireRootedSaveAsPathProp] = value; }
228                 }
229
230                 [ConfigurationProperty ("sendCacheControlHeader", DefaultValue = "True")]
231                 public bool SendCacheControlHeader {
232                         get { return (bool) base[sendCacheControlHeaderProp]; }
233                         set { base[sendCacheControlHeaderProp] = value; }
234                 }
235
236                 [TypeConverter (typeof (TimeSpanSecondsConverter))]
237                 [ConfigurationProperty ("shutdownTimeout", DefaultValue = "00:01:30")]
238                 public TimeSpan ShutdownTimeout {
239                         get { return (TimeSpan) base[shutdownTimeoutProp]; }
240                         set { base[shutdownTimeoutProp] = value; }
241                 }
242
243                 [ConfigurationProperty ("useFullyQualifiedRedirectUrl", DefaultValue = "False")]
244                 public bool UseFullyQualifiedRedirectUrl {
245                         get { return (bool) base[useFullyQualifiedRedirectUrlProp]; }
246                         set { base[useFullyQualifiedRedirectUrlProp] = value; }
247                 }
248
249                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
250                 [ConfigurationProperty ("waitChangeNotification", DefaultValue = "0")]
251                 public int WaitChangeNotification {
252                         get { return (int) base[waitChangeNotificationProp]; }
253                         set { base[waitChangeNotificationProp] = value; }
254                 }
255
256                 protected override ConfigurationPropertyCollection Properties {
257                         get { return properties; }
258                 }
259         }
260 }
261
262 #endif