/// <summary>
        /// A method handler and a request allocator are stored using the designated
        /// path as a key. If an entry already exists, it is replaced by the new one.
        /// </summary>

        public void AddPathHandler(RestMethodHandler mh, string path, RestMethodAllocator ra)
        {
            if (!IsEnabled)
            {
                return;
            }

            if (pathHandlers.ContainsKey(path))
            {
                Rest.Log.DebugFormat("{0} Replacing handler for <${1}>", MsgId, path);
                pathHandlers.Remove(path);
            }

            if (pathAllocators.ContainsKey(path))
            {
                Rest.Log.DebugFormat("{0} Replacing allocator for <${1}>", MsgId, path);
                pathAllocators.Remove(path);
            }

            Rest.Log.DebugFormat("{0} Adding path handler for {1}", MsgId, path);

            pathHandlers.Add(path, mh);
            pathAllocators.Add(path, ra);
        }
Example #2
0
        /// <summary>
        /// A method handler and a request allocator are stored using the designated
        /// path as a key. If an entry already exists, it is replaced by the new one.
        /// </summary>

        public void AddPathHandler(RestMethodHandler mh, string path, RestMethodAllocator ra)
        {
            if (!IsEnabled)
            {
                return;
            }

            if (pathHandlers.ContainsKey(path))
            {
                Rest.Log.DebugFormat("{0} Replacing handler for <${1}>", MsgId, path);
                pathHandlers.Remove(path);
            }

            if (pathAllocators.ContainsKey(path))
            {
                Rest.Log.DebugFormat("{0} Replacing allocator for <${1}>", MsgId, path);
                pathAllocators.Remove(path);
            }

            Rest.Log.DebugFormat("{0} Adding path handler for {1}", MsgId, path);

            pathHandlers.Add(path, mh);
            pathAllocators.Add(path, ra);
        }