public static void ConfigureLegacyRoutes(this HttpRouteCollection routeCollection) { // Sonarr appends /api by default to all Torznab indexers, so we need that "ignored" // parameter to catch these as well. // Legacy fallback for Torznab results routeCollection.MapHttpRoute( name: "LegacyTorznab", routeTemplate: "torznab/{indexerId}/{ignored}", defaults: new { controller = "Results", action = "Torznab", ignored = RouteParameter.Optional, } ); // Legacy fallback for Potato results routeCollection.MapHttpRoute( name: "LegacyPotato", routeTemplate: "potato/{indexerId}/{ignored}", defaults: new { controller = "Results", action = "Potato", ignored = RouteParameter.Optional, } ); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "ServiceBus_DefaultApi", routeTemplate: "api/sb/{controller}/{action}", defaults: new { action = RouteParameter.Optional }); routes.MapHttpRoute( name: "Entity_DefaultApi", routeTemplate: "api/entity/{controller}/{action}", defaults: new { action = RouteParameter.Optional } ); routes.MapHttpRoute( name: "UDS_DefaultApi", routeTemplate: "api/uds/{controller}/{action}", defaults: new { action = RouteParameter.Optional } ); routes.MapHttpRoute( name: "WorkflowManager_DefaultApi", routeTemplate: "api/wfm/{controller}/{action}", defaults: new { action = RouteParameter.Optional } ); routes.MapHttpRoute( name: "Builder_DefaultApi", routeTemplate: "api/builder/{controller}/{action}", defaults: new { action = RouteParameter.Optional } ); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute("BeersRoute", "beers/{id}", new { controller = "Beer" }); // this one is needed only because beers vs. 1 beer are separated into 2 controllers routes.MapHttpRoute("DefaultApi", "{controller}/{id}", new { id = RouteParameter.Optional }); routes.MapHttpRoute("BreweryBeersRoute", "breweries/{id}/beers", new { controller = "BeersFromBrewery" }); routes.MapHttpRoute("StyleBeersRoute", "styles/{id}/beers", new { controller = "BeersFromStyle" }); }
private static void RegisterRoutes( HttpRouteCollection routes ) { routes.MapHttpRoute( "Info", "", new { controller = "Game", action = "Info" } ); routes.MapHttpRoute( "User", "User", new { controller = "User" } ); routes.MapHttpRoute( "Game", "{action}", new { controller = "Game" } ); routes.MapHttpRoute( "Default", "{controller}/{action}" ); }
public static void Register(HttpConfiguration config) { HttpRouteCollection routes = config.Routes; routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }, constraints: new { id = @"\d+" } ); routes.MapHttpRoute("DefaultApiWithAction", "Api/{controller}/{action}/{id}", new { id = RouteParameter.Optional }); routes.MapHttpRoute("DefaultApiGet", "Api/{controller}", new { action = "Get" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) }); routes.MapHttpRoute("DefaultApiPost", "Api/{controller}", new { action = "Post" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Post) }); // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type. // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries. // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712. //config.EnableQuerySupport(); // To disable tracing in your application, please comment out or remove the following line of code // For more information, refer to: http://www.asp.net/web-api config.EnableSystemDiagnosticsTracing(); // Use camel case for JSON data. config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new DefaultContractResolver(); config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); }
public static void MapHttpRoute(HttpRouteCollection routeCollection) { const string thisController = "StaticInfo"; routeCollection.MapHttpRoute(thisController + "1", "api/" + thisController + "/{section}", new { controller = thisController }); routeCollection.MapHttpRoute(thisController + "2", "api/" + thisController + "/{group}/{section}", new { controller = thisController }); }
/// <summary> /// Initializes the ASP.NET MVC routes used by Viewer. /// </summary> public static void InitRoutes(HttpConfiguration config) { GroupdocsViewerApiController controller = new GroupdocsViewerApiController(); HttpRouteCollection routes = config.Routes; if (routes == null) { throw new InvalidOperationException("Cannot obtain 'Routes' collection"); } routes.MapHttpRoute( "fonts", "document-viewer/fonts/{name}", new { controller = "GroupdocsViewer", action = "GetFont" } ); routes.MapHttpRoute( "images", "document-viewer/images/{name}", new { controller = "GroupdocsViewer", action = "GetEmbeddedImage" } ); routes.MapHttpRoute( "genericRoute", "document-viewer/{action}", new { controller = "GroupdocsViewerApi" } ); }
public static void MapUrlVersionedHttpRoute(this HttpRouteCollection routes, string name, string routeTemplate, object defaults = null, object constraints = null) { var versionedRouteName = name + "Versioned"; var versionedRouteTemplate = "v{version}/" + routeTemplate; var versionedConstraints = constraints == null ? new { version = @"^[0-9]{1,2}$" } : AddProperty(constraints, "version", @"^[0-9]{1,2}$"); routes.MapHttpRoute(versionedRouteName, versionedRouteTemplate, defaults, versionedConstraints); routes.MapHttpRoute(name, routeTemplate, defaults, constraints); }
public static void MapVidyanoWeb2Route(this HttpRouteCollection routes, string routeTemplate = "web2/") { if (Web2Controller.UseWeb2Home) { routes.MapHttpRoute("VidyanoWeb2 Branch", routeTemplate + "branch/{branch}/{*id}", new { controller = "Web2", action = "Get", id = RouteParameter.Optional }); } routes.MapHttpRoute("VidyanoWeb2 Vulcanize", routeTemplate + "vulcanize/{*id}", new { controller = "Web2", action = "Vulcanize", id = RouteParameter.Optional }); routes.MapHttpRoute("VidyanoWeb2", routeTemplate + "{*id}", new { controller = "Web2", action = "Get", id = RouteParameter.Optional }); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "docs/{id}", defaults: new { controller = "Default", id = RouteParameter.Optional } ); routes.MapHttpRoute( name: "Default2Api", routeTemplate: "{controller}/{id}", defaults: new { controller = "Default", id = RouteParameter.Optional } ); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); routes.MapHttpRoute( name: "Main", routeTemplate: "", defaults: new { controller = "Main", action = "GetView" } ); }
private static void AddRoutesToConfiguration(HttpRouteCollection routeCollection) { routeCollection.MapHttpRoute(UserInfo, RouteMappings[UserInfo], new { controller = Account, }, null); routeCollection.MapHttpRoute(Logout, RouteMappings[Logout], new { controller = Account }); routeCollection.MapHttpRoute(ManageInfo, RouteMappings[ManageInfo], new { controller = Account }); routeCollection.MapHttpRoute(ChangePassword, RouteMappings[ChangePassword], new { controller = Account }); routeCollection.MapHttpRoute(SetPassword, RouteMappings[SetPassword], new { controller = Account }); routeCollection.MapHttpRoute(RemoveLogin, RouteMappings[RemoveLogin], new { controller = Account }); routeCollection.MapHttpRoute(ExternalLogin, RouteMappings[ExternalLogin], new { controller = Account }); routeCollection.MapHttpRoute(AddExternalLogin, RouteMappings[AddExternalLogin], new { controller = Account }); routeCollection.MapHttpRoute(Register, RouteMappings[Register], new { controller = Account }); routeCollection.MapHttpRoute(RegisterExternal, RouteMappings[RegisterExternal], new { controller = Account }); }
static void RegisterRoute(HttpRouteCollection routes) { routes.MapHttpRoute( "get receipt", "receipt", new { controller = "Receipt", action = "BuildReceipt" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Post) }); routes.MapHttpRoute("add promotion barcode", "promotions/{Type}", new { controller = "Promotion", action = "AddPromotionBarcode" }, new { HttpMethod = new HttpMethodConstraint(HttpMethod.Post) }); routes.MapHttpRoute("get promotion barcodes", "promotions/{Type}", new { controller = "Promotion", action = "GetBarcodesByType" }, new { HttpMethod = new HttpMethodConstraint(HttpMethod.Get) }); routes.MapHttpRoute("delete promotion barcodes", "promotions/{Type}", new { controller = "Promotion", action = "DeleteBarcodesByType" }, new { HttpMethod = new HttpMethodConstraint(HttpMethod.Delete) }); }
public void Can_get_names_from_a_HttpRouteCollection() { var routes = new HttpRouteCollection(); routes.MapHttpRoute("foo.show", "foo/{id}"); routes.MapHttpRoute("foo.one.two", "foo/{one}/{two}"); routes.MapHttpRoute("bar.show", "bar/{id}", defaults: new { id = RouteParameter.Optional }); routes.MapHttpRoute("bar.one.two", "bar/{one}/{two}", defaults: new { one = RouteParameter.Optional, two = RouteParameter.Optional }); routes.MapHttpRoute("constraint", "constraints/{id:int}", null, new { id = @"\d+" }); var names = routes.GetNames(); Assert.True(names.Count == 5); }
private static void ConfigureHttpRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "Courses", routeTemplate: "", defaults: new { controller = "Courses" } ); routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "Home", routeTemplate: "", defaults: new { controller = "Home", action = "Index" } ); routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }
public void Can_get_names_from_a_HttpRouteCollection() { var routes = new HttpRouteCollection(); routes.MapHttpRoute("foo.show", "foo/{id}"); routes.MapHttpRoute("foo.one.two", "foo/{one}/{two}"); routes.MapHttpRoute("bar.show", "bar/{id}", defaults: new { id = RouteParameter.Optional }); routes.MapHttpRoute("bar.one.two", "bar/{one}/{two}", defaults: new { one = RouteParameter.Optional, two = RouteParameter.Optional }); routes.MapHttpRoute("constraint", "constraints/{id:int}", null, new { id = @"\d+" }); var names = routes.GetNames(); Assert.True(names.Count == 5); }
public void InitializeRoute(HttpRouteCollection routes) { routes.MapHttpRoute( "about message", "", new { controller = "Default" }); routes.MapHttpRoute( "unauthorized resource returns OK", "unauthorized/ok", new { controller = "UnauthorizedRedirectResource", action = "ActionReturnsOK" }); routes.MapHttpRoute( "unauthorized resource returns unauthorized", "unauthorized/unauthorized", new { controller = "UnauthorizedRedirectResource", action = "ActionReturnsUnauthorized" }); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: ProductsWithDetailsRouteName, routeTemplate: "api/products/details", defaults: new { controller = "Products", id = RouteParameter.Optional, action = "Details" }); routes.MapHttpRoute( name: ProductsSoldOutRouteName, routeTemplate: "api/products/{id}/mark-sold-out", defaults: new { controller = "Products", action = "MarkSoldOut" }); routes.MapHttpRoute( name: ProductsRouteName, routeTemplate: "api/products/{id}", defaults: new { controller = "Products", id = RouteParameter.Optional, action = "Default" }); routes.MapHttpRoute( name: CustomerAddressesRouteName, routeTemplate: "api/customers/{id}/addresses", defaults: new { controller = "Customers", action = "AddressesForCustomer" }); routes.MapHttpRoute( name: CustomersRouteName, routeTemplate: "api/customers/{id}", defaults: new { controller = "Customers", id = RouteParameter.Optional, action = "Default" }); }
public static void RegisterRoutes(HttpRouteCollection routeCollection) { routeCollection.MapHttpRoute(name: "DefaultHttpRoute", routeTemplate: "api/{controller}/{key}", defaults: new { key = RouteParameter.Optional }, constraints: new { key = new GuidRouteConstraint() }); }
public void InitializeRoute(HttpRouteCollection routes) { routes.MapHttpRoute( "about message", "", new { controller = "Default" }); }
public static HttpRequestMessage CreateAHttpRequestMessage( string baseUrl, string routeName, string routeTemplate, object routeDefaults = null, object routeConstraints = null ) { HttpRouteCollection routes = new HttpRouteCollection(); routes.MapHttpRoute( routeName, routeTemplate, defaults: routeDefaults, constraints: routeConstraints ); HttpConfiguration configuration = new HttpConfiguration(routes); HttpRequestMessage request = new HttpRequestMessage { RequestUri = new Uri(baseUrl), Method = HttpMethod.Get }; request.SetConfiguration(configuration); return(request); }
private void Configure(HttpRouteCollection routes) { routes.MapHttpRoute( "DefaultApiWithId", "Api/Test", new { controller = "Test" }); }
public void RegisterHttpRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "ReportingServicesApi", routeTemplate: "data/plugins/reportingservices/{controller}/{action}" ); }
private static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute("Info", "", new { controller = "Game", action = "Info" }); routes.MapHttpRoute("Test", "Test", new { controller = "Game", action = "Test" }); routes.MapHttpRoute("Messages", "Messages", new { controller = "Game", action = "Messages" }); routes.MapHttpRoute("User", "User", new { controller = "User" }); routes.MapHttpRoute("UnitList", "Unit", new { controller = "Unit" }); routes.MapHttpRoute("Unit", "Unit/{id}", new { controller = "Unit", action = "Info" }); routes.MapHttpRoute("UnitAction", "Unit/{id}/{action}", new { controller = "Unit" }); routes.MapHttpRoute("UnitMove", "Unit/{id}/Move/{direction}", new { controller = "Unit", action = "Move" }); routes.MapHttpRoute("Place", "{coordinate}", new { controller = "Game", action = "Place" }); routes.MapHttpRoute("Acting", "{coordinate}/{id}", new { controller = "Game", action = "Acting" }); }
/// <summary> /// Routing registration. /// </summary> /// <param name="routes">The Http routes</param> public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "AddWord", routeTemplate: "AddWord/{word}", defaults: new { controller = "Default", action = "AddWord" }, constraints: new {} ); routes.MapHttpRoute( name: "Count", routeTemplate: "Count", defaults: new { controller = "Default", action = "Count" }, constraints: new {} ); }
public void RegisterHttpRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "CallCenterApi", routeTemplate: "data/plugins/callcenter/{controller}/{action}" ); }
private HttpRequestMessage CloneHttpRequestMessageWithoutConstraints(HttpRequestMessage httpRequestMessage) { var request = new HttpRequestMessage { Content = httpRequestMessage.Content, Method = httpRequestMessage.Method, RequestUri = httpRequestMessage.RequestUri, Version = httpRequestMessage.Version }; var original = httpRequestMessage.GetConfiguration().Routes; var modified = new HttpRouteCollection(); var names = original.GetNames(); foreach (var routeName in names) { var route = original[routeName]; modified.MapHttpRoute(routeName, route.RouteTemplate, route.Defaults); } request.SetConfiguration(new HttpConfiguration(modified)); return(request); }
public void RegisterHttpRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "RegistrationApi", routeTemplate: "data/plugins/registration/{controller}/{action}" ); }
public void RegisterHttpRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "ESignatureApi", routeTemplate: "data/plugins/esignature/{controller}/{action}" ); }
/// <summary> /// Routing registration. /// </summary> /// <param name="routes">The Http routes</param> public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "AddWord", routeTemplate: "AddWord/{word}", defaults: new {controller = "Default", action = "AddWord"}, constraints: new {} ); routes.MapHttpRoute( name: "Count", routeTemplate: "Count", defaults: new {controller = "Default", action = "Count"}, constraints: new {} ); }
public void RegisterHttpRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "ClinicalApi", routeTemplate: "data/plugins/clinical/{controller}/{action}" ); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute(name: "CalculatorApi", routeTemplate: "api/{action}", defaults: new { controller = "Default" } ); }
private void Configure(HttpRouteCollection routes) { routes.MapHttpRoute( "DefaultApiWithId", "Api/TestDependency", new { controller = "TestDependency" }); }
/// <summary> /// Map odata route with query string or header constraints /// </summary> public static void MapODataServiceRoute( this HttpRouteCollection routes, string routeName, string routePrefix, IEdmModel model, IODataPathHandler pathHandler, IEnumerable <IODataRoutingConvention> routingConventions, object queryConstraints, object headerConstraints) { if (routes == null) { throw new ArgumentNullException(nameof(routes)); } string routeTemplate = string.IsNullOrEmpty(routePrefix) ? ODataRouteConstants.ODataPathTemplate : routePrefix + "/" + ODataRouteConstants.ODataPathTemplate; ODataVersionRouteConstraint routeConstraint = new ODataVersionRouteConstraint(pathHandler, model, routeName, routingConventions, queryConstraints, headerConstraints); var constraints = new HttpRouteValueDictionary(); constraints.Add(ODataRouteConstants.ConstraintName, routeConstraint); routes.MapHttpRoute( routeName, routeTemplate, defaults: null, constraints: constraints); }
public void RegisterHttpRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "SchedulingApi", routeTemplate: "data/plugins/scheduling/{controller}/{action}" ); }
internal static void ConfigureApiRoutes(this HttpRouteCollection routes) { routes.MapHttpRoute( name: "GetLogs", routeTemplate: "api/getAllLogs", defaults: new { controller = "LogsApi", action = "GetAllLogs", id = RouteParameter.Optional }); }
static void RegisterRoute(HttpRouteCollection routes) { routes.MapHttpRoute( "get receipt", "receipt", new { controller = "Receipt", action = "BuildReceipt" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Post) }); routes.MapHttpRoute( "create promotions", "promotions/{promotionType}", new { controller = "Promotion", action = "CreatePromotion" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Post) }); routes.MapHttpRoute( "get promotion barcodes", "promotions/{promotionType}", new { controller = "Promotion", action = "GetPromotion" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) }); routes.MapRoute( "promotions/{promotionType}", "Promotion", "DeletePromotion", HttpMethod.Delete); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "Leases", routeTemplate: "leases/{resource}/{leaseId}", defaults: new { controller = "Leases", resource = RouteParameter.Optional, leaseId = RouteParameter.Optional } ); }
private static void ConfigureWebApiRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( "API Default", "api/{controller}/{id}", new { id = RouteParameter.Optional } ); }
private static void Configure(HttpRouteCollection routes) { routes.MapHttpRoute( "DefaultApiWithId", "Api/{controller}/{id}", new { id = RouteParameter.Optional }, new { id = @"\d+" }); }
private static void Configure(HttpRouteCollection routes) { routes.MapHttpRoute( "DefaultApiWithId", "Api/{controller}/{id}", new { id = RouteParameter.Optional }, new { id = @"\d+" }); }
internal static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( "DefaultHttpRoute", "api/{controller}/{key}", defaults: new { key = RouteParameter.Optional }, constraints: new { key = new GuidRouteConstraint() }); }
public static void RegisterRoutes(HttpRouteCollection routes) { // To debug routes locally using the built in ASP.NET development server, go to /routes.axd routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }); }
/// <summary> /// Routing registration. /// </summary> /// <param name="routes"></param> public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( "Default", "api/{controller}/{id}", new {controller = "Default", id = RouteParameter.Optional}, new {} ); }
public static void RegisterRoutes(HttpRouteCollection routes) { AttributeRoutingRegisterRoutes(routes); routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }
private void AddHttpRoutes(HttpRouteCollection routeCollection) { //var routes = GetRoutes(); foreach (var route in this.routes) { routeCollection.MapHttpRoute( route.Name, route.Template, route.Defaults); } }
private static void Configure(HttpRouteCollection routes) { routes.MapHttpRoute( "Hello", "Api/Hello", new { controller = "Test", action = "ReturnHello" }); }
private static void RegisterRoutes( HttpRouteCollection routes ) { routes.MapHttpRoute( "Info", "", new { controller = "Game", action = "Info" } ); routes.MapHttpRoute( "Test", "Test", new { controller = "Game", action = "Test" } ); routes.MapHttpRoute( "Messages", "Messages", new { controller = "Game", action = "Messages" } ); routes.MapHttpRoute( "User", "User", new { controller = "User" } ); routes.MapHttpRoute( "UnitList", "Unit", new { controller = "Unit" } ); routes.MapHttpRoute( "Unit", "Unit/{id}", new { controller = "Unit", action = "Info" } ); routes.MapHttpRoute( "UnitAction", "Unit/{id}/{action}", new { controller = "Unit" } ); routes.MapHttpRoute( "UnitMove", "Unit/{id}/Move/{direction}", new { controller = "Unit", action = "Move" } ); routes.MapHttpRoute( "Place", "{coordinate}", new { controller = "Game", action = "Place" } ); routes.MapHttpRoute( "Acting", "{coordinate}/{id}", new { controller = "Game", action = "Acting" } ); }
/// <summary> /// Registers the HTTP routes. /// </summary> public static void RegisterRoutes(HttpRouteCollection httpRouteCollection) { // Build the HTTP method contraint. HttpMethodConstraint httpMethodConstraint = new HttpMethodConstraint(HttpMethod.Post); // Map the HTTP route. httpRouteCollection.MapHttpRoute( name: "api/scheduling/course-schedules", routeTemplate: "api/scheduling/course-schedules", defaults: new { controller = "CourseSchedules" }, constraints: new { httpMethods = httpMethodConstraint }); }
public static void RegisterRoutes(HttpRouteCollection routes) { routes.IgnoreRoute("Html", "{whatever}.html/{*pathInfo}"); routes.IgnoreRoute("FilesRoute", "app/{*pathInfo}"); routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "{controller}/{action}/{id}", defaults: new { controller = "Default", action = "Get", id = RouteParameter.Optional } ); }
/// <summary> /// Routing registration. /// </summary> /// <param name="routes">The http routes.</param> public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "Default", routeTemplate: "{action}", defaults: new {controller = "Default", action = "Index"}, constraints: new {} ); routes.MapHttpRoute( name: "AddWord", routeTemplate: "AddWord/{word}", defaults: new {controller = "Default", action = "AddWord"}, constraints: new {} ); routes.MapHttpRoute( name: "Files", routeTemplate: "Files/{name}", defaults: new {controller = "File", action = "Get"}, constraints: new {} ); }
public static void RegisterRoutes(HttpRouteCollection routes) { #if false // RegisterLinkWithWebApi is obsolete because the URI Template syntax it expects is not consistent with RFC6570 used by HAL spec LinkTemplates.Beers.Beer.RegisterLinkWithWebApi<BeerController>(routes); LinkTemplates.Beers.GetBeers.RegisterLinkWithWebApi<BeersController>(routes); LinkTemplates.Beers.SearchBeers.RegisterLinkWithWebApi<BeersController>(routes); LinkTemplates.Breweries.Brewery.RegisterLinkWithWebApi<BreweriesController>(routes); LinkTemplates.Breweries.GetBreweries.RegisterLinkWithWebApi<BreweriesController>(routes); LinkTemplates.Breweries.AssociatedBeers.RegisterLinkWithWebApi<BeersFromBreweryController>(routes); LinkTemplates.BeerStyles.Style.RegisterLinkWithWebApi<StylesController>(routes); LinkTemplates.BeerStyles.GetStyles.RegisterLinkWithWebApi<StylesController>(routes); LinkTemplates.BeerStyles.AssociatedBeers.RegisterLinkWithWebApi<StylesController>(routes); LinkTemplates.BeerDetails.GetBeerDetail.RegisterLinkWithWebApi<BeerDetailController>(routes); #else routes.MapHttpRoute("BeersRoute", "beers/{id}", new { controller = "Beer" }); // this one is needed only because beers vs. 1 beer are separated into 2 controllers routes.MapHttpRoute("DefaultApi", "{controller}/{id}", new { id = RouteParameter.Optional }); routes.MapHttpRoute("BreweryBeersRoute", "breweries/{id}/beers", new { controller = "BeersFromBrewery" }); routes.MapHttpRoute("StyleBeersRoute", "styles/{id}/beers", new { controller = "BeersFromStyle" }); #endif }
/// <summary> /// Routing registration. /// </summary> /// <param name="routes"></param> public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpRoute( name: "Default", routeTemplate: "{action}", defaults: new { controller = "Default", action = "Index" }, constraints: new { } ); routes.MapHttpRoute( name: "GetAllByDomain", routeTemplate: "entities/domain/{domain}", defaults: new { controller = "RefM", action = "GetAllByDomain" }, constraints: new { } ); routes.MapHttpRoute( name: "GetByCode", routeTemplate: "entities/code/{code}", defaults: new { controller = "RefM", action = "GetByCode" }, constraints: new { } ); routes.MapHttpRoute( name: "GetByCodeValue", routeTemplate: "entities/codevalue/{codevalue}", defaults: new { controller = "RefM", action = "GetByCodeValue" }, constraints: new { } ); routes.MapHttpRoute( name: "GetAllByLink", routeTemplate: "entities/link/{link}", defaults: new { controller = "RefM", action = "GetAllByLink" }, constraints: new { } ); }
public void MapHttpRoute1CreatesRoute() { // Arrange HttpRouteCollection routes = new HttpRouteCollection(); object defaults = new { d1 = "D1" }; // Act IHttpRoute route = routes.MapHttpRoute("name", "template", defaults); // Assert Assert.NotNull(route); Assert.Equal("template", route.RouteTemplate); Assert.Equal(1, route.Defaults.Count); Assert.Equal("D1", route.Defaults["d1"]); Assert.Same(route, routes["name"]); }
private static void ConfigureRoutes(HttpRouteCollection routes) { routes.MapHttpRoute("ApiV2Root", "api/v2", new { controller = "root" }); routes.MapHttpRoute("ApiV2Metadata", "api/v2/$metadata", new { controller = "metadata" }); routes.MapHttpRoute("ApiV2Package", "api/v2/package", new { controller = "package" }); routes.MapHttpRoute("ApiV2Packages", "api/v2/Packages(Id='{id}',Version='{version}')", new { controller = "packageDetails" }); routes.MapHttpRoute("ApiV2PackageDetails", "api/v2/package/{id}/{version}", new { controller = "packageDownload" }); routes.MapHttpRoute("ApiV2FindPackagesById", "api/v2/FindPackagesById()", new { controller = "findPackage" }); routes.MapHttpRoute("ApiV2Search", "api/v2/Search()", new { controller = "search" }); routes.MapHttpRoute("ApiV2PackageDelete", "api/v2/{id}/{version}", new { controller = "packageDetails" }); }
public static void MapApiRoutes(HttpRouteCollection routes) { routes.MapHttpRoute(RouteNames.Home, "", new { controller = "Home" }, new { acceptHeader = new AcceptHtmlConstraint() }); routes.MapHttpRoute(RouteNames.IndexingStatus, "api/indexing/{action}", new {controller = "Indexing", action = "Status"}); routes.MapHttpRoute(RouteNames.UserApi, "api/users/{username}", new { controller = "User", username = RouteParameter.Optional }); routes.MapHttpRoute(RouteNames.PackageDownloadAnyVersion, "api/v2/package/{id}/content", new { controller = "Packages", action = "GetPackageInfo" }); routes.MapHttpRoute(RouteNames.PackageDownload, "api/v2/package/{id}/{version}/content", new { controller = "Packages", action = "DownloadPackage" }); routes.MapHttpRoute(RouteNames.PackageInfo, "api/v2/package/{id}/{version}", new {controller = "Packages", action = "GetPackageInfo", version = ""}, new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) }); routes.MapHttpRoute(RouteNames.PackageApi, "api/v2/package/{id}/{version}", new { controller = "Packages", id = "", version = "" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Put, HttpMethod.Post, HttpMethod.Delete) }); routes.MapHttpRoute(RouteNames.TabCompletionPackageIds, "api/v2/package-ids", new { controller = "TabCompletion", action = "GetMatchingPackages", maxResults = 30, includePrerelease = false }); routes.MapHttpRoute(RouteNames.TabCompletionPackageVersions, "api/v2/package-versions/{packageId}", new {controller = "TabCompletion", action = "GetPackageVersions", includePrerelease = false}); }
public static HttpRequestMessage CreateAHttpRequestMessage( string baseUrl, string routeName, string routeTemplate, object routeDefaults = null, object routeConstraints = null ) { HttpRouteCollection routes = new HttpRouteCollection(); routes.MapHttpRoute( routeName, routeTemplate, defaults: routeDefaults, constraints: routeConstraints ); HttpConfiguration configuration = new HttpConfiguration(routes); HttpRequestMessage request = new HttpRequestMessage { RequestUri = new Uri(baseUrl), Method = HttpMethod.Get }; request.SetConfiguration(configuration); return request; }