Beispiel #1
0
        public void RegisterEndpoint(EndpointHandler endpointHandler)
        {
            if (!IsSupported)
            {
                return;
            }

            string endpointId = GetEndpointId(endpointHandler.HttpMethod, endpointHandler.UrlPattern);

            if (idToEndpointHandlerMap.ContainsKey(endpointId))
            {
                this.RemoveEndpoint(endpointHandler);
            }

            idToEndpointHandlerMap.Add(endpointId, endpointHandler);
            sortedEndpointHandlers.Add(endpointHandler);
            sortedEndpointHandlers.Sort(EndpointHandler.CompareDescendingByPlaceholderCount);
        }
 public static void RemoveEndpoint(this HttpServer httpServer, EndpointHandler endpointHandler)
 {
     httpServer.RemoveEndpoint(endpointHandler.HttpMethod, endpointHandler.UrlPattern);
 }