/// <summary> /// Initializes REST Foundation configuration with the default IoC container. /// </summary> /// <param name="serviceLocator">A service locator instance.</param> /// <returns>The configuration options object.</returns> public RestOptions Initialize(IServiceLocator serviceLocator) { if (serviceLocator == null) { throw new ArgumentNullException("serviceLocator"); } if (ServiceLocator != null) { throw new InvalidOperationException(Resources.Global.AlreadyConfigured); } RouteCollection routes = RouteTable.Routes; routes.Add(new Route(String.Empty, serviceLocator.GetService<RootRouteHandler>())); ServiceLocator = serviceLocator; m_options = new RestOptions(); return m_options; }
private string GenerateProxyUrl(RestOptions options) { string serviceUrl = m_serviceContext.Request.Url.GetLeftPart(UriPartial.Path); return String.Concat(serviceUrl.TrimEnd(Slash), Slash, options.ServiceProxyRelativeUrl, Slash, "index"); }