Exemplo n.º 1
0
		public AcceptEncodingConfig (AcceptEncodingConfig parent)
		{
			if (parent == null)
				return;

			// FIXME: copy parent's config
		}
        public object Create(object parent, object configContext, XmlNode section)
        {
            AcceptEncodingConfig cfg = new AcceptEncodingConfig(parent as AcceptEncodingConfig);

            if (section.Attributes != null && section.Attributes.Count != 0)
            {
                ThrowException("Unrecognized attribute", section);
            }

            XmlNodeList nodes = section.ChildNodes;

            foreach (XmlNode child in nodes)
            {
                XmlNodeType ntype = child.NodeType;
                if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
                {
                    continue;
                }

                if (ntype != XmlNodeType.Element)
                {
                    ThrowException("Only elements allowed", child);
                }

                string name = child.Name;
                if (name == "clear")
                {
                    if (child.Attributes != null && child.Attributes.Count != 0)
                    {
                        ThrowException("Unrecognized attribute", child);
                    }

                    cfg.Clear();
                    continue;
                }

                if (name != "add")
                {
                    ThrowException("Unexpected element", child);
                }

                string encoding = ExtractAttributeValue("encoding", child, false);
                string type     = ExtractAttributeValue("type", child, false);
                string disabled = ExtractAttributeValue("disabled", child, true);
                if (disabled != null && disabled == "yes")
                {
                    continue;
                }

                if (child.Attributes != null && child.Attributes.Count != 0)
                {
                    ThrowException("Unrecognized attribute", child);
                }

                cfg.Add(encoding, type);
            }

            return(cfg);
        }
Exemplo n.º 3
0
        public AcceptEncodingConfig(AcceptEncodingConfig parent)
        {
            if (parent == null)
            {
                return;
            }

            // FIXME: copy parent's config
        }
Exemplo n.º 4
0
		void CheckIfAddFilter (object sender, EventArgs args)
		{
			HttpApplication app = (HttpApplication) sender;
			HttpRequest request = app.Request;
			HttpResponse response = app.Response;

			if (config == null)
				config = (AcceptEncodingConfig) app.Context.GetConfig (configSection);

			if (config != null)
				config.SetFilter (response, request.Headers ["Accept-Encoding"]);
		}
		public object Create (object parent, object configContext, XmlNode section)
		{
			AcceptEncodingConfig cfg = new AcceptEncodingConfig (parent as AcceptEncodingConfig);
			
			if (section.Attributes != null && section.Attributes.Count != 0)
				ThrowException ("Unrecognized attribute", section);

			XmlNodeList nodes = section.ChildNodes;
			foreach (XmlNode child in nodes) {
				XmlNodeType ntype = child.NodeType;
				if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
					continue;

				if (ntype != XmlNodeType.Element)
					ThrowException ("Only elements allowed", child);
				
				string name = child.Name;
				if (name == "clear") {
					if (child.Attributes != null && child.Attributes.Count != 0)
						ThrowException ("Unrecognized attribute", child);

					cfg.Clear ();
					continue;
				}
					
				if (name != "add")
					ThrowException ("Unexpected element", child);

				string encoding = ExtractAttributeValue ("encoding", child, false);
				string type = ExtractAttributeValue ("type", child, false);
				string disabled = ExtractAttributeValue ("disabled", child, true);
				if (disabled != null && disabled == "yes")
					continue;

				if (child.Attributes != null && child.Attributes.Count != 0)
					ThrowException ("Unrecognized attribute", child);

				cfg.Add (encoding, type);
			}

			return cfg;
		}