Exemplo n.º 1
0
 private static void RegisterUrls(UrlBuilder builder)
 {
     builder.MapUrl("sample").ToServiceContract<ISampleService>();
 }
Exemplo n.º 2
0
        private static void RegisterUrls(UrlBuilder urlBuilder)
        {
            urlBuilder.MapUrl("home")
                      .ToServiceContract<IIndexService>()
                      .WithBehaviors(new StatisticsBehavior(), new LoggingBehavior())
                      .DoNotValidateRequests();

            urlBuilder.MapUrl("secure")
                      .ToServiceContract<IIndexService>()
                      .WithBehaviors(new DigestAuthenticationBehavior(), new AuthorizationBehavior("administrators"), new StatisticsBehavior(), new LoggingBehavior());

            urlBuilder.MapUrl("dynamic")
                      .ToServiceContract<IDynamicService>()
                      .BlockMediaTypesForFormatter<FormsFormatter>();

            urlBuilder.MapUrl("touch-map")
                      .ToServiceContract<ITouchMapService>()
                      .WithBehaviors(new HttpsOnlyBehavior());

            urlBuilder.MapUrl("hello")
                      .ToServiceContract<HelloService>();

            urlBuilder.MapUrl("secure-hello")
                      .ToServiceContract<HelloService>().WithBehaviors(new CustomHmacAuthenticationBehavior());

            urlBuilder.MapUrl("feed.{format}")
                      .ToHttpHandler<FeedHandler>(null, new RouteHash(format => "^atom|rss$"));

            urlBuilder.MapUrl("download")
                      .ToHttpHandler<DownloadHandler>();

            urlBuilder.MapUrl("upload")
                      .ToHttpHandler<UploadHandler>();

            urlBuilder.MapUrl("index")
                      .ToHtmlPage("~/index.html");

            urlBuilder.MapUrl("faq")
                      .ToWebFormsPage("~/Views/Faq.aspx");
        }