/** * Copyright 2011 OpenDDR LLC * This software is distributed under the terms of the GNU Lesser General Public License. * * * This file is part of OpenDDR Simple APIs. * OpenDDR Simple APIs is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, version 3 of the License. * * OpenDDR Simple APIs is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Simple APIs. If not, see . * */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using W3c.Ddr.Simple; namespace Oddr.Models { /// /// Evidence consisting of HTTP Header name and value pairs. /// public class ODDRHTTPEvidence : IEvidence { /// /// Headers dictionary. /// Dictionary headers; /// /// Empty constructor. /// public ODDRHTTPEvidence() { headers = new Dictionary(); } /// /// Headers Dictionary parameterizable costructor. /// /// Headers Dictionary. public ODDRHTTPEvidence(Dictionary map) { headers = new Dictionary(map); } public bool Exist(string property) { if (property == null) { return false; } return headers.ContainsKey(property.ToLower()); } public String Get(String header) { string toRet = null; headers.TryGetValue(header.ToLower(), out toRet); return toRet; } public virtual void Put(String key, String value) { headers.Add(key.ToLower(), value); } } }