Example #1
0
        public void RegisterRestPaths(HttpListenerHost appHost, Type requestType)
        {
            var attrs = appHost.GetRouteAttributes(requestType);

            foreach (RouteAttribute attr in attrs)
            {
                var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, attr.Path, attr.Verbs, attr.IsHidden, attr.Summary, attr.Description);

                RegisterRestPath(restPath);
            }
        }
Example #2
0
        public void RegisterRestPaths(HttpListenerHost appHost, Type requestType)
        {
            var attrs = appHost.GetRouteAttributes(requestType);

            foreach (RouteAttribute attr in attrs)
            {
                var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, attr.Path, attr.Verbs, attr.Summary, attr.Notes);

                if (!restPath.IsValid)
                {
                    throw new NotSupportedException(string.Format(
                                                        "RestPath '{0}' on Type '{1}' is not Valid", attr.Path, requestType.GetMethodName()));
                }

                RegisterRestPath(restPath);
            }
        }