Skip to content
Snippets Groups Projects

update: update to sdk 1.1.7, add http caching to endpoints

Merged Martin Lowe requested to merge malowe/main/http-caching into main
2 files
+ 6
1
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -23,6 +23,8 @@ import org.eclipsefoundation.caching.service.CachingService;
import org.eclipsefoundation.cve.model.CveData;
import org.eclipsefoundation.cve.namespace.CveUrlParameterNames;
import org.eclipsefoundation.cve.service.CveService;
import org.eclipsefoundation.http.namespace.CacheControlCommonValues;
import org.jboss.resteasy.reactive.Cache;
import com.rometools.rome.feed.synd.SyndContent;
import com.rometools.rome.feed.synd.SyndContentImpl;
@@ -61,6 +63,7 @@ public class CveResource {
CachingService cache;
@GET
@Cache(maxAge = CacheControlCommonValues.SAFE_CACHE_MAX_AGE)
public Response get(@QueryParam(CveUrlParameterNames.PROJECT_NAME_PARAM_NAME) String projectName) {
List<CveData> out;
if (StringUtils.isNotBlank(projectName)) {
@@ -75,6 +78,7 @@ public class CveResource {
@GET
@Path("rss.xml")
@Produces(MediaType.APPLICATION_XML)
@Cache(maxAge = CacheControlCommonValues.SAFE_CACHE_MAX_AGE)
public Response getCveRSSFeed(@QueryParam(CveUrlParameterNames.PROJECT_NAME_PARAM_NAME) String projectName) {
CacheWrapper<String> cachedFeed = cache.get("all", null, String.class, () -> {
SyndFeed feed = new SyndFeedImpl();
@@ -127,6 +131,7 @@ public class CveResource {
@GET
@Path("/{id}")
@Cache(maxAge = CacheControlCommonValues.AGGRESSIVE_CACHE_MAX_AGE)
public Response getById(@PathParam("id") String id) {
Optional<CveData> cve = cveSource.getCve(id);
Loading