コード例 #1
0
ファイル: EndpointHandler.cs プロジェクト: SirLangley/Play
        public bool TryHandle(HttpListenerContext context)
        {
            HttpListenerRequest request = context.Request;

            if (string.Equals(request.HttpMethod, HttpMethod.Method, StringComparison.OrdinalIgnoreCase) &&
                patternMatcher.TryMatch(request.RawUrl, out Dictionary <string, string> placeholderValues))
            {
                EndpointRequestData endpointRequestData = new EndpointRequestData(context, placeholderValues);
                requestCallback(endpointRequestData);
                return(true);
            }

            return(false);
        }
コード例 #2
0
 private static void DefaultNoEndpointFoundCallback(EndpointRequestData requestData)
 {
     requestData.Context.Response.SendResponse("", HttpStatusCode.NotFound);
 }