public async Task <bool> OnAuthorization(HttpContext context, HttpServerMessageSender sender, string messageId, IEnumerable <IAuthorizationFilter> filters)
        {
            foreach (var filter in filters)
            {
                var path = HttpUtility.UrlDecode(GetRoutePath(context.Request.Path.ToString()));
                path = AppConfig.MapRoutePathOptions.GetRoutePath(path, context.Request.Method);
                var serviceRoute = await _serviceRouteProvider.GetRouteByPathOrRegexPath(path, context.Request.Method);

                if (serviceRoute == null)
                {
                    throw new CPlatformException($"未能找到:{path}-{context.Request.Method}的路由信息", StatusCode.Http404EndpointStatusCode);
                }
                context.Items.Add("route", serviceRoute);
                var filterContext = new AuthorizationFilterContext
                {
                    Path    = path,
                    Context = context,
                    Route   = serviceRoute
                };
                await filter.OnAuthorization(filterContext);

                if (filterContext.Result != null)
                {
                    await sender.SendAndFlushAsync(new TransportMessage(messageId, filterContext.Result));

                    return(false);
                }
            }
            return(true);
        }
        public async Task <bool> OnException(HttpContext context, HttpServerMessageSender sender, string messageId, Exception exception, IEnumerable <IExceptionFilter> filters)
        {
            foreach (var filter in filters)
            {
                var path          = HttpUtility.UrlDecode(GetRoutePath(context.Request.Path.ToString()));
                var filterContext = new ExceptionContext
                {
                    RoutePath = path,
                    Context   = context,
                    Exception = exception
                };
                await filter.OnException(filterContext);

                if (filterContext.Result != null)
                {
                    await sender.SendAndFlushAsync(new TransportMessage(messageId, filterContext.Result));

                    return(false);
                }
            }
            return(true);
        }