diff --git a/Examples/BookingSystem.AspNetCore/Helpers/ResponseContentHelper.cs b/Examples/BookingSystem.AspNetCore/Helpers/ResponseContentHelper.cs
index 997975ac..cab8abd6 100644
--- a/Examples/BookingSystem.AspNetCore/Helpers/ResponseContentHelper.cs
+++ b/Examples/BookingSystem.AspNetCore/Helpers/ResponseContentHelper.cs
@@ -1,46 +1,15 @@
-using System;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-
-namespace BookingSystem.AspNetCore.Helpers
+namespace BookingSystem.AspNetCore.Helpers
{
public static class ResponseContentHelper
{
public static Microsoft.AspNetCore.Mvc.ContentResult GetContentResult(this OpenActive.Server.NET.OpenBookingHelper.ResponseContent response)
{
- return new CacheableContentResult
+ return new Microsoft.AspNetCore.Mvc.ContentResult
{
StatusCode = (int)response.StatusCode,
Content = response.Content,
- ContentType = response.ContentType,
- CacheControlMaxAge = response.CacheControlMaxAge,
+ ContentType = response.ContentType
};
}
}
-
- ///
- /// ContentResult that also sets Cache-Control: public, max-age=X, s-maxage=X
- /// See https://developer.openactive.io/publishing-data/data-feeds/scaling-feeds for more information
- ///
- public class CacheableContentResult : Microsoft.AspNetCore.Mvc.ContentResult
- {
- public TimeSpan CacheControlMaxAge { get; set; }
-
- public override async Task ExecuteResultAsync(ActionContext context)
- {
- if (CacheControlMaxAge != null)
- {
- context.HttpContext.Response.GetTypedHeaders().CacheControl =
- new Microsoft.Net.Http.Headers.CacheControlHeaderValue()
- {
- Public = true,
- MaxAge = CacheControlMaxAge,
- SharedMaxAge = CacheControlMaxAge,
- };
- }
-
- await base.ExecuteResultAsync(context);
- }
- }
}
diff --git a/Examples/BookingSystem.AspNetFramework/Helpers/ResponseContentHelper.cs b/Examples/BookingSystem.AspNetFramework/Helpers/ResponseContentHelper.cs
index b4eb3484..80b626b7 100644
--- a/Examples/BookingSystem.AspNetFramework/Helpers/ResponseContentHelper.cs
+++ b/Examples/BookingSystem.AspNetFramework/Helpers/ResponseContentHelper.cs
@@ -14,17 +14,6 @@ public static HttpResponseMessage GetContentResult(this OpenActive.Server.NET.Op
StatusCode = response.StatusCode
};
resp.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(response.ContentType);
- /// Sets additional header Cache-Control: public, max-age=X, s-maxage=X
- /// See https://developer.openactive.io/publishing-data/data-feeds/scaling-feeds for more information
- if (response.CacheControlMaxAge != null)
- {
- resp.Headers.CacheControl = new CacheControlHeaderValue()
- {
- Public = true,
- MaxAge = response.CacheControlMaxAge,
- SharedMaxAge = response.CacheControlMaxAge
- };
- }
// Ensure custom error messages do not override responses
HttpContext.Current.Response.TrySkipIisCustomErrors = true;
return resp;
diff --git a/OpenActive.Server.NET/CustomBookingEngine/CustomBookingEngine.cs b/OpenActive.Server.NET/CustomBookingEngine/CustomBookingEngine.cs
index bdd16ee1..80f6f211 100644
--- a/OpenActive.Server.NET/CustomBookingEngine/CustomBookingEngine.cs
+++ b/OpenActive.Server.NET/CustomBookingEngine/CustomBookingEngine.cs
@@ -169,15 +169,16 @@ public async Task RenderDatasetSite()
///
public async Task GetOpenDataRPDEPageForFeed(string feedname, string afterTimestamp, string afterId, string afterChangeNumber)
{
- return GetResponseContentFromRPDEPage(
+ return ResponseContent.RpdeResponse(
(await RouteOpenDataRPDEPageForFeed(
feedname,
RpdeOrderingStrategyRouter.ConvertStringToLongOrThrow(afterTimestamp, nameof(afterTimestamp)),
afterId,
RpdeOrderingStrategyRouter.ConvertStringToLongOrThrow(afterChangeNumber, nameof(afterChangeNumber))
- )));
+ )).ToString());
}
+
///
/// Handler for an RPDE endpoint
/// Designed to be used on a single controller method with a "feedname" parameter,
@@ -190,14 +191,11 @@ public async Task GetOpenDataRPDEPageForFeed(string feedname, s
///
public async Task GetOpenDataRPDEPageForFeed(string feedname, long? afterTimestamp, string afterId, long? afterChangeNumber)
{
- return GetResponseContentFromRPDEPage(await RouteOpenDataRPDEPageForFeed(feedname, afterTimestamp, afterId, afterChangeNumber));
+ return ResponseContent.RpdeResponse((await RouteOpenDataRPDEPageForFeed(feedname, afterTimestamp, afterId, afterChangeNumber)).ToString());
}
- private ResponseContent GetResponseContentFromRPDEPage(RpdePage rpdePage)
- {
- var cacheMaxAge = rpdePage.Items.Count == 0 ? this.settings.RPDELastPageCacheDuration : this.settings.RPDEPageCacheDuration;
- return ResponseContent.RpdeResponse(rpdePage.ToString(), cacheMaxAge);
- }
+
+
///
/// Handler for an RPDE endpoint
diff --git a/OpenActive.Server.NET/OpenBookingHelper/Content/ResponseContent.cs b/OpenActive.Server.NET/OpenBookingHelper/Content/ResponseContent.cs
index 2dd5a3c6..7a372724 100644
--- a/OpenActive.Server.NET/OpenBookingHelper/Content/ResponseContent.cs
+++ b/OpenActive.Server.NET/OpenBookingHelper/Content/ResponseContent.cs
@@ -1,5 +1,4 @@
using OpenActive.NET;
-using System;
using System.Net;
namespace OpenActive.Server.NET.OpenBookingHelper
@@ -61,14 +60,13 @@ public static ResponseContent OrdersFeedRpdeResponse(string content)
};
}
- public static ResponseContent RpdeResponse(string content, TimeSpan cacheControlMaxAge)
+ public static ResponseContent RpdeResponse(string content)
{
return new ResponseContent
{
Content = content,
ContentType = OpenActiveMediaTypes.RealtimePagedDataExchange.Version1,
- StatusCode = HttpStatusCode.OK,
- CacheControlMaxAge = cacheControlMaxAge
+ StatusCode = HttpStatusCode.OK
};
}
@@ -84,10 +82,6 @@ public static ResponseContent RpdeResponse(string content, TimeSpan cacheControl
// Summary:
// The intended HTTP status code of the response
public HttpStatusCode StatusCode { get; internal set; } = HttpStatusCode.OK;
- //
- // Summary:
- // The Cache-Control header intended for the response (public, max-age=X)
- public TimeSpan CacheControlMaxAge { get; internal set; }
public override string ToString()
{
diff --git a/OpenActive.Server.NET/OpenBookingHelper/Settings/BookingEngineSettings.cs b/OpenActive.Server.NET/OpenBookingHelper/Settings/BookingEngineSettings.cs
index 4e2ce37a..551b2c54 100644
--- a/OpenActive.Server.NET/OpenBookingHelper/Settings/BookingEngineSettings.cs
+++ b/OpenActive.Server.NET/OpenBookingHelper/Settings/BookingEngineSettings.cs
@@ -26,16 +26,6 @@ public class BookingEngineSettings
public OrdersRPDEFeedGenerator OrdersFeedGenerator { get; set; }
public OrdersRPDEFeedGenerator OrderProposalsFeedGenerator { get; set; }
public SellerStore SellerStore { get; set; }
- public bool HasSingleSeller { get; set; } = false;
- ///
- /// TTL in the Cache-Control header for all RPDE pages that contain greater than zero items
- /// See https://developer.openactive.io/publishing-data/data-feeds/scaling-feeds for CDN configuration instructions
- ///
- public TimeSpan RPDEPageCacheDuration { get; set; } = TimeSpan.FromHours(1);
- ///
- /// TTL in the Cache-Control header for all RPDE pages that contain zero items
- /// See https://developer.openactive.io/publishing-data/data-feeds/scaling-feeds for CDN configuration instructions
- ///
- public TimeSpan RPDELastPageCacheDuration { get; set; } = TimeSpan.FromSeconds(8);
+ public bool HasSingleSeller { get; set; }
}
}