2 // System.Web.HttpCacheVaryByParams
\r
5 // Patrik Torstensson (Patrik.Torstensson@labs2.com)
\r
9 using System.Collections;
\r
11 namespace System.Web {
\r
12 public sealed class HttpCacheVaryByParams {
\r
13 private Hashtable _Items;
\r
14 private bool _IgnoreParams;
\r
15 private bool _Wildcard;
\r
16 private bool _Dirty;
\r
18 // TODO: We need internal methods here to communicate with CachePolicy
\r
20 internal HttpCacheVaryByParams() {
\r
23 public bool IgnoreParams {
\r
25 return _IgnoreParams;
\r
29 if (_Wildcard || null != _Items) {
\r
34 _IgnoreParams = value;
\r
38 internal HttpResponseHeader GetResponseHeader ()
\r
41 throw new Exception ("Can not get VaryByParams Header when params are ignored.");
\r
44 return new HttpResponseHeader ("Vary", "*");
\r
49 StringBuilder builder = new StringBuilder ();
\r
50 foreach (string item in _Items.Keys) {
\r
51 if (!(bool) _Items [item])
\r
53 builder.Append (item + ";");
\r
56 return new HttpResponseHeader ("Vary", builder.ToString ());
\r
59 public bool this[string header] {
\r
61 if (null == header) {
\r
62 throw new ArgumentNullException("header");
\r
65 if (header == "*") {
\r
69 if (null != _Items) {
\r
70 return _Items.ContainsKey(header);
\r
77 if (null == header) {
\r
78 throw new ArgumentNullException("header");
\r
87 if (header == "*") {
\r
94 if (null == _Items) {
\r
95 _Items = new Hashtable();
\r
98 _Items[header] = true;
\r
103 internal string [] GetParamNames ()
\r
105 if (_Items == null)
\r
108 string[] prms = new string [_Items.Count];
\r
110 foreach (string prm in _Items.Keys)
\r