initial implementation of http capability provider introduced in .net 4.0.
authoraerisg222 <mmorano@cid>
Thu, 2 Aug 2012 16:49:26 +0000 (12:49 -0400)
committeraerisg222 <mmorano@cid>
Thu, 2 Aug 2012 16:49:26 +0000 (12:49 -0400)
mcs/class/System.Web/System.Web.Configuration_2.0/HttpCapabilitiesBase.cs
mcs/class/System.Web/System.Web.Configuration_2.0/HttpCapabilitiesDefaultProvider.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.Configuration_2.0/HttpCapabilitiesProvider.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/HttpRequest.cs
mcs/class/System.Web/net_4_0_System.Web.dll.sources

index 39d91ee7c507b7a4886dc03986c274e454981d9a..99486acfd2b04f4b96dea4e95995d9c6e459ecdd 100644 (file)
@@ -249,7 +249,7 @@ namespace System.Web.Configuration
 
                public IDictionary Capabilities {
                        get { return capabilities; }
-                       set { capabilities = value; }
+                       set { capabilities = new Hashtable(value, StringComparer.OrdinalIgnoreCase); }
                }
 
                int defaultSubmitButtonLimit;
@@ -1147,6 +1147,14 @@ namespace System.Web.Configuration
                                return useOptimizedCacheKey;
                        }
                }
+               
+#if NET_4_0
+               static HttpCapabilitiesProvider _provider = new HttpCapabilitiesDefaultProvider();
+               public static HttpCapabilitiesProvider BrowserCapabilitiesProvider { 
+                       get { return _provider; }
+                       set { _provider = value; }
+               }
+#endif
        }
 }
 
diff --git a/mcs/class/System.Web/System.Web.Configuration_2.0/HttpCapabilitiesDefaultProvider.cs b/mcs/class/System.Web/System.Web.Configuration_2.0/HttpCapabilitiesDefaultProvider.cs
new file mode 100644 (file)
index 0000000..acfe50a
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// System.Web.Configuration.HttpCapabilitiesDefaultProvider
+//
+// Authors:
+//     Mike Morano (mmorano@mikeandwan.us)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections;
+
+
+namespace System.Web.Configuration
+{
+       public class HttpCapabilitiesDefaultProvider : HttpCapabilitiesProvider
+       {
+               public TimeSpan CacheTime { get; set; }
+               public Type ResultType { get; set; }
+               public int UserAgentCacheKeyLength { get; set; }
+               
+               
+               public HttpCapabilitiesDefaultProvider()
+               {
+                       UserAgentCacheKeyLength = 64;
+               }
+               
+               
+               public HttpCapabilitiesDefaultProvider(HttpCapabilitiesDefaultProvider parent)
+               {
+                       CacheTime = parent.CacheTime;
+                       ResultType = parent.ResultType;
+                       UserAgentCacheKeyLength = parent.UserAgentCacheKeyLength;
+               }
+               
+               
+               public void AddDependency(string variable)
+               {
+                       throw new NotImplementedException();
+               }
+               
+               
+               public virtual void AddRuleList(ArrayList ruleList)
+               {
+                       throw new NotImplementedException();
+               }
+               
+               
+               public override HttpBrowserCapabilities GetBrowserCapabilities(HttpRequest request)
+               {
+                       HttpBrowserCapabilities bcap = new HttpBrowserCapabilities();
+                       bcap.capabilities = HttpCapabilitiesBase.GetConfigCapabilities(null, request).Capabilities;
+
+                       return bcap;
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web.Configuration_2.0/HttpCapabilitiesProvider.cs b/mcs/class/System.Web/System.Web.Configuration_2.0/HttpCapabilitiesProvider.cs
new file mode 100644 (file)
index 0000000..6cfbccf
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// System.Web.Configuration.HttpCapabilitiesProvider
+//
+// Authors:
+//     Mike Morano (mmorano@mikeandwan.us)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System.Web;
+
+
+namespace System.Web.Configuration
+{
+       public abstract class HttpCapabilitiesProvider
+       {
+               protected HttpCapabilitiesProvider()
+               {
+
+               }
+
+
+               public abstract HttpBrowserCapabilities GetBrowserCapabilities (HttpRequest request);
+       }
+}
+
+
index e8396503bb344be4dda2ebc0b1dd2917e0fef620..decaf3eb31516985e3ea9007b0226e3df691d7b4 100644 (file)
@@ -315,8 +315,12 @@ namespace System.Web
                public HttpBrowserCapabilities Browser {
                        get {
                                if (browser_capabilities == null)
+#if NET_4_0
+                                       browser_capabilities = HttpCapabilitiesBase.BrowserCapabilitiesProvider.GetBrowserCapabilities (this);
+#else
                                        browser_capabilities = (HttpBrowserCapabilities)
                                                HttpCapabilitiesBase.GetConfigCapabilities (null, this);
+#endif
 
                                return browser_capabilities;
                        }
index fa07f8133f73e7d3357e7b099bdde3d214ddbb49..15836d5404be7aacc00f25c3d5283a0404c55ee4 100644 (file)
@@ -14,6 +14,8 @@ System.Web.Caching/ResponseElement.cs
 System.Web.Caching/SubstitutionResponseElement.cs
 System.Web.Configuration_2.0/VersionConverter.cs
 System.Web.Configuration_2.0/MachineKeyCompatibilityMode.cs
+System.Web.Configuration_2.0/HttpCapabilitiesProvider.cs
+System.Web.Configuration_2.0/HttpCapabilitiesDefaultProvider.cs
 System.Web.Compilation/FolderLevelBuildProviderAppliesTo.cs
 System.Web.Compilation/FolderLevelBuildProviderAppliesToAttribute.cs
 System.Web.Compilation/RouteUrlExpressionBuilder.cs