Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public static void RemoveEndpoint(this HttpServer httpServer, EndpointHandler endpointHandler)
 {
     httpServer.RemoveEndpoint(endpointHandler.HttpMethod, endpointHandler.UrlPattern);
 }