当前位置: 首页>>代码示例>>C#>>正文


C# GenericHTTPMethod类代码示例

本文整理汇总了C#中GenericHTTPMethod的典型用法代码示例。如果您正苦于以下问题:C# GenericHTTPMethod类的具体用法?C# GenericHTTPMethod怎么用?C# GenericHTTPMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GenericHTTPMethod类属于命名空间,在下文中一共展示了GenericHTTPMethod类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OSHttpHttpHandler

 /// <summary>
 /// Instantiate an HTTP handler.
 /// </summary>
 /// <param name="handler">a GenericHTTPMethod</param>
 /// <param name="method">null or HTTP method regex</param>
 /// <param name="path">null or path regex</param>
 /// <param name="query">null or dictionary with query regexs</param>
 /// <param name="headers">null or dictionary with header
 /// regexs</param>
 /// <param name="whitelist">null or IP address whitelist</param>
 public OSHttpHttpHandler(GenericHTTPMethod handler, Regex method, Regex path,
                          Dictionary<string, Regex> query,
                          Dictionary<string, Regex> headers, Regex whitelist)
     : base(method, path, query, headers, new Regex(@"^text/html", RegexOptions.IgnoreCase | RegexOptions.Compiled),
            whitelist)
 {
     _handler = handler;
 }
开发者ID:CassieEllen,项目名称:opensim,代码行数:18,代码来源:OSHttpHttpHandler.cs

示例2: GenericHTTPDOSProtector

 public GenericHTTPDOSProtector(GenericHTTPMethod normalMethod, GenericHTTPMethod throttledMethod, BasicDosProtectorOptions options)
 {
     _normalMethod = normalMethod;
     _throttledMethod = throttledMethod;
     
     _options = options;
     _dosProtector = new BasicDOSProtector(_options);
 }
开发者ID:CassieEllen,项目名称:opensim,代码行数:8,代码来源:GenericHTTPBasicDOSProtector.cs

示例3: TryGetHTTPHandler

        private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler)
        {
//            m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);

            string bestMatch = null;

            lock (m_HTTPHandlers)
            {
                foreach (string pattern in m_HTTPHandlers.Keys)
                {
                    if (handlerKey.StartsWith(pattern))
                    {
                        if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
                        {
                            bestMatch = pattern;
                        }
                    }
                }

                if (String.IsNullOrEmpty(bestMatch))
                {
                    HTTPHandler = null;
                    return false;
                }
                else
                {
                    HTTPHandler = m_HTTPHandlers[bestMatch];
                    return true;
                }
            }
        }
开发者ID:justasabc,项目名称:opensim,代码行数:31,代码来源:BaseHttpServer.cs

示例4: AddPollServiceHTTPHandler

        public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args)
        {
            bool pollHandlerResult = false;
            lock (m_pollHandlers)
            {
                if (!m_pollHandlers.ContainsKey(methodName))
                {
                    m_pollHandlers.Add(methodName,args);
                    pollHandlerResult = true;
                }
            }

            if (pollHandlerResult)
                return AddHTTPHandler(methodName, handler);

            return false;
        }
开发者ID:justasabc,项目名称:opensim,代码行数:17,代码来源:BaseHttpServer.cs

示例5: AddHTTPHandler

        public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
        {
            //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);

            lock (m_HTTPHandlers)
            {
                if (!m_HTTPHandlers.ContainsKey(methodName))
                {
                    m_HTTPHandlers.Add(methodName, handler);
                    return true;
                }
            }

            //must already have a handler for that path so return false
            return false;
        }
开发者ID:justasabc,项目名称:opensim,代码行数:16,代码来源:BaseHttpServer.cs

示例6: TryGetHTTPHandlerPathBased

        private bool TryGetHTTPHandlerPathBased(string path, out GenericHTTPMethod httpHandler)
        {
            httpHandler = null;
            // Pull out the first part of the path
            // splitting the path by '/' means we'll get the following return..
            // {0}/{1}/{2}
            // where {0} isn't something we really control 100%

            string[] pathbase = path.Split('/');
            string searchquery = "/";

            if (pathbase.Length < 1)
                return false;

            for (int i = 1; i < pathbase.Length; i++)
            {
                searchquery += pathbase[i];
                if (pathbase.Length - 1 != i)
                    searchquery += "/";
            }

            // while the matching algorithm below doesn't require it, we're expecting a query in the form
            //
            //   [] = optional
            //   /resource/UUID/action[/action]
            //
            // now try to get the closest match to the reigstered path
            // at least for OGP, registered path would probably only consist of the /resource/

            string bestMatch = null;

//            m_log.DebugFormat(
//                "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery);

            lock (m_HTTPHandlers)
            {
                foreach (string pattern in m_HTTPHandlers.Keys)
                {
                    if (searchquery.ToLower().StartsWith(pattern.ToLower()))
                    {
                        if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length)
                        {
                            // You have to specifically register for '/' and to get it, you must specifically request it
                            if (pattern == "/" && searchquery == "/" || pattern != "/")
                                bestMatch = pattern;
                        }
                    }
                }

                if (String.IsNullOrEmpty(bestMatch))
                {
                    httpHandler = null;
                    return false;
                }
                else
                {
                    if (bestMatch == "/" && searchquery != "/")
                        return false;

                    httpHandler =  m_HTTPHandlers[bestMatch];
                    return true;
                }
            }
        }
开发者ID:justasabc,项目名称:opensim,代码行数:64,代码来源:BaseHttpServer.cs

示例7: RestHTTPHandler

 public RestHTTPHandler(string httpMethod, string path, GenericHTTPMethod dhttpMethod)
     : base(httpMethod, path)
 {
     m_dhttpMethod = dhttpMethod;
 }
开发者ID:Gnu32,项目名称:Silverfin,代码行数:5,代码来源:RestHTTPHandler.cs

示例8: TryGetHTTPHandler

        internal bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler)
        {
            //            MainConsole.Instance.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);

            string bestMatch = null;

            lock (m_HTTPHandlers)
            {
                if (m_HTTPHandlers.TryGetValue(handlerKey, out HTTPHandler))
                    return true;
                foreach (string pattern in m_HTTPHandlers.Keys)
                {
                    if (handlerKey.StartsWith(pattern))
                    {
                        if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
                        {
                            bestMatch = pattern;
                        }
                    }
                }

                if (String.IsNullOrEmpty(bestMatch))
                {
                    HTTPHandler = null;
                    return false;
                }
                HTTPHandler = m_HTTPHandlers[bestMatch];
                return true;
            }
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:30,代码来源:BaseHttpServer.cs

示例9: TryGetHTTPHandler

        private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler)
        {
//            m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);

            string bestMatch = null;

            m_HTTPHandlers.ForEach(delegate(string pattern)
            {
                if ((handlerKey == pattern)
                    || (handlerKey.StartsWith(pattern) && (HANDLER_SEPARATORS.IndexOf(handlerKey[pattern.Length]) >= 0)))
                {
                    if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
                    {
                        bestMatch = pattern;
                    }
                }
            });

            if (String.IsNullOrEmpty(bestMatch))
            {
                HTTPHandler = null;
                return false;
            }
            else
            {
                HTTPHandler = m_HTTPHandlers[bestMatch];
                return true;
            }
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:29,代码来源:BaseHttpServer.cs

示例10: AddHTTPHandler

        public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
        {
            //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);

            try
            {
                m_HTTPHandlers.AddIfNotExists(methodName, delegate() { return handler; });
                return true;
            }
            catch(ThreadedClasses.RwLockedDictionary<string, GenericHTTPMethod>.KeyAlreadyExistsException)
            {
            }
            //must already have a handler for that path so return false
            return false;
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:15,代码来源:BaseHttpServer.cs

示例11: RestHTTPHandler

 public RestHTTPHandler(
     string httpMethod, string path, GenericHTTPMethod dhttpMethod, string name, string description)
     : base(httpMethod, path, name, description)
 {
     m_dhttpMethod = dhttpMethod;
 }
开发者ID:CassieEllen,项目名称:opensim,代码行数:6,代码来源:RestHTTPHandler.cs


注:本文中的GenericHTTPMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。