Beispiel #1
0
        public IRestEndpoint AggregateNext(string fullResourcePath)
        {
            if (string.IsNullOrEmpty(fullResourcePath))
            {
                return(_startEndpoint);
            }

            IRestEndpoint endpoint = _startEndpoint;

            string[] dirs = fullResourcePath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string dir in dirs)
            {
                var path = new AggregatorNextPath(dir, _namingConventionSwitcher);

                try
                {
                    endpoint = endpoint.Next(path);
                }
                catch (Exception ex)
                {
                    throw new NextEndpointErrorException(path, ex);
                }

                if (endpoint == null)
                {
                    throw new NextEndpointNotFoundException(path);
                }
            }

            return(endpoint);
        }
Beispiel #2
0
 public NextEndpointErrorException(AggregatorNextPath dir, Exception innerException)
     : base("Error loading the '" + dir.Raw + "' endpoint: " + innerException.Message, innerException)
 {
 }
Beispiel #3
0
 public NextEndpointNotFoundException(AggregatorNextPath dir)
     : base(ErrorStatus.NotFound, "The '" + dir.Raw + "' endpoint was not found.")
 {
 }