예제 #1
0
파일: TM_REST.cs 프로젝트: sempf/Dev
 public static void SetRouteTable()
 {
     var webServiceHostFactory = new WebServiceHostFactory();
     var serviceRoute = new ServiceRoute(urlPath, webServiceHostFactory, typeof (TM_REST));
     RouteTable.Routes.Add(serviceRoute);
     //RouteTable.Routes.Add(new ServiceRoute(urlPath_Tests, new WebServiceHostFactory(), typeof(REST_Tests)));
 }
예제 #2
0
        private static void MapRoutes(RouteCollection routes)
        {
            // Route to create a new package
            routes.MapDelegate("CreatePackage",
                               "api/v2/package",
                               new { httpMethod = new HttpMethodConstraint("PUT") },
                               context => CreatePackageService().CreatePackage(context.HttpContext));

            // Route to delete packages
            routes.MapDelegate("DeletePackage",
                               "api/v2/package/{packageId}/{version}",
                               new { httpMethod = new HttpMethodConstraint("DELETE") },
                               context => CreatePackageService().DeletePackage(context.HttpContext));

            // Route to get packages
            routes.MapDelegate("DownloadPackage",
                               "api/v2/package/{packageId}/{version}",
                               new { httpMethod = new HttpMethodConstraint("GET") },
                               context => CreatePackageService().DownloadPackage(context.HttpContext));

#if DEBUG
            // The default route is http://{root}/nuget/Packages
            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            routes.Add("nuget", serviceRoute);
#endif
        }
예제 #3
0
 private static void MapRoutes(RouteCollection routes) {
     // The default route is http://{root}/nuget/Packages
     var factory = new DataServiceHostFactory();
     var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
     serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
     serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
     routes.Add("nuget", serviceRoute);
 }
 public static void MapServiceRoute(this RouteCollection routes, Type serviceType, string routePrefix, IHttpHostConfigurationBuilder builder = null, params object[] constraints)
 {
     if (routes == null)
     {
         throw new ArgumentNullException("routes");
     }
     var route = new ServiceRoute(routePrefix, new HttpConfigurableServiceHostFactory {Builder = builder}, serviceType);
     routes.Add(route);
 }
예제 #5
0
        public static void Start()
        {
            // The default route is http://{root}/nuget/Packages

            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            RouteTable.Routes.Add("nuget", serviceRoute);
        }
예제 #6
0
        protected void Application_Start(object sender, EventArgs e)
        {
            System.ServiceModel.Activation.WebServiceHostFactory WSHF =
                new System.ServiceModel.Activation.WebServiceHostFactory();

            System.ServiceModel.Activation.ServiceRoute ss =
                new System.ServiceModel.Activation.ServiceRoute(
                    "wcfservice", WSHF, typeof(WCFClass.GasPriceService));
            System.Web.Routing.RouteTable.Routes.Add(ss);
        }
예제 #7
0
파일: Routes.cs 프로젝트: finsaspa/Caravan
        private static void MapRoutes(RouteCollection routes) {
            // Route to create a new package(http://{root}/nuget)
            routes.MapDelegate("CreatePackageNuGet",
                               "nuget",
                               new { httpMethod = new HttpMethodConstraint("PUT") },
                               context => CreatePackageService().CreatePackage(context.HttpContext));

            // The default route is http://{root}/nuget/Packages
            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            routes.Add("nuget", serviceRoute);
        }
예제 #8
0
 /// <summary>
 /// 通过反射注册服务
 /// </summary>
 public static void RegisterAllService()
 {
     var ass = (typeof(ServiceRegister)).Assembly;
     var ts = ass.GetTypes();
     foreach (var t in ts)
     {
         //约定:类型名以Service结尾的为WCF服务类型
         if (t.Name.EndsWith("Service"))
         {
             var serviceName = t.FullName.Substring("XL.Service.".Length);
             serviceName = serviceName.Replace(".", "-");
             var sr = new ServiceRoute(serviceName, wshf, t);
             RouteTable.Routes.Add(sr);
         }
     }
 }
        private static void MapRoutes(RouteCollection routes)
        {
            // The default route is http://{root}/nuget/Packages
            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            routes.Add("nuget", serviceRoute);

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            // For some godforsaken reason, the PublishPackage route (registered by NuGet.Server) causes the { controller, action } => url mapping to always return this route.
            routes.Remove(routes.OfType<Route>().Single(r => r.DataTokens != null && r.DataTokens.ContainsKey("__RouteName") && (string)r.DataTokens["__RouteName"] == "PublishPackage"));
        }
        public void MapDataServiceRoutes(RouteCollection routes)
        {
            var dataServiceHostFactory = new NinjectDataServiceHostFactory();

            var serviceRoute = new ServiceRoute(ODataRoutePath, dataServiceHostFactory, typeof(PackageDataService))
            {
                Defaults = RouteNames.PackageFeedRouteValues,
                Constraints = RouteNames.PackageFeedRouteValues
            };

            routes.Add(RouteNames.Packages.Feed, serviceRoute);
        }
예제 #11
0
        /// <summary>
        /// The application_ start.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Application_Start(object sender, EventArgs e)
        {
            _log.Debug("Starting application");
            SdmxException.SetMessageResolver(new MessageDecoder());
            UriUtils.FixSystemUriDotBug();

            var wsdlRegistry = WsdlRegistry.Instance;
            var sdmxRestServiceHostFactory = new SdmxRestServiceHostFactory(typeof(IStaticWsdlService));

            var serviceRoute = new ServiceRoute("wsdl", sdmxRestServiceHostFactory, typeof(StaticWsdlService));
            RouteTable.Routes.Add(serviceRoute);
            wsdlRegistry.Add(
                new WsdlInfo { Name  = "NSIEstatV20Service", OriginalPath = "sdmx_estat/NSI.wsdl" },
                new WsdlInfo { Name = "NSIStdV20Service", OriginalPath = "sdmx_org/NSI.wsdl" },
                new WsdlInfo { Name = "SdmxService", OriginalPath = "sdmxv21/SDMX-WS.wsdl" });

            RouteTable.Routes.Add(new ServiceRoute("NSIEstatV20Service", new SoapServiceHostFactory(typeof(INSIEstatV20Service), "sdmx_estat/NSI.wsdl"), typeof(NsiEstatV20Service)));
            RouteTable.Routes.Add(new ServiceRoute("NSIStdV20Service", new SoapServiceHostFactory(typeof(INSIStdV20Service), "sdmx_org/NSI.wsdl"), typeof(NsiStdV20Service)));
            RouteTable.Routes.Add(new ServiceRoute("SdmxService", new SoapServiceHostFactory(typeof(INSIStdV21Service), "sdmxv21/SDMX-WS.wsdl"), typeof(NSIStdV21Service)));
            RouteTable.Routes.Add(new ServiceRoute("rest/data", new SdmxRestServiceHostFactory(typeof(IDataResource)), typeof(DataResource)));
            RouteTable.Routes.Add(new ServiceRoute("rest", new SdmxRestServiceHostFactory(typeof(IStructureResource)), typeof(StructureResource)));
        }
예제 #12
0
파일: TM_REST.cs 프로젝트: TeamMentor/Dev
 public static void SetRouteTable()
 {
     webServiceHostFactory = new TMWebServiceHostFactory();
     serviceRoute = new ServiceRoute(urlPath, webServiceHostFactory, typeof (TM_REST));
     RouteTable.Routes.Add(serviceRoute);
 }
예제 #13
0
        public DynamicServiceRoute(string pathPrefix, object defaults, string[] namespaces, ServiceHostFactoryBase serviceHostFactory, Type serviceType)
        {
            if (pathPrefix.IndexOf("{*", StringComparison.Ordinal) >= 0)
                throw new ArgumentException("Path prefix can not include catch-all route parameters.", "pathPrefix");

            if (!pathPrefix.EndsWith("/"))
                pathPrefix += "/";

            pathPrefix += "{*servicePath}";

            virtualPath = serviceType.FullName + "-" + Guid.NewGuid().ToString() + "/";
            innerServiceRoute = new ServiceRoute(virtualPath, serviceHostFactory, serviceType);
            
            innerRoute = new Route(pathPrefix, new RouteValueDictionary(defaults), this)
                             {
                                 DataTokens = new RouteValueDictionary()
                             };

            if ((namespaces != null) && (namespaces.Length > 0))
            {
                innerRoute.DataTokens["Namespaces"] = namespaces;
            }
        }