Exemplo n.º 1
0
        public void AddHandler( string path, RequestHandler handler )
        {
            path = path.Slashed().ToLower();

            if( _paths.ContainsKey(path)) {
                return;
            }

            _paths.Add( path, handler );
            if (_current != null) {
                Restart();
            }
        }
Exemplo n.º 2
0
        public void AddHandler( string path, RequestHandler handler )
        {
            if(  string.IsNullOrEmpty(path) ) {
                path = "/";
            }
            path = path.ToLower();

            if( !path.StartsWith("/")) {
                path = "/" + path;
            }

            if (!path.EndsWith("/")) {
                path = path + "/";
            }

            if( _paths.ContainsKey(path)) {
                return;
            }

            _paths.Add( path, handler );
            if (_current != null) {
                Restart();
            }
        }