cachingProhibited

Description

This directive is used to filter out requests that forbid caching. It is used as a building block of the cache directive to prevent caching if the client requests so.

Example

final Route route = cachingProhibited(() ->
  complete("abc")
);

// tests:
testRoute(route)
  .run(HttpRequest.GET("/"))
  .assertStatusCode(StatusCodes.NOT_FOUND);

final CacheControl noCache = CacheControl.create(CacheDirectives.NO_CACHE);
testRoute(route)
  .run(HttpRequest.GET("/").addHeader(noCache))
  .assertEntity("abc");
The source code for this page can be found here.