Class ApiHttpPolicyHandler
java.lang.Object
com.kingsrook.qqq.api.javalin.ApiHttpPolicyHandler
Applies an
ApiHttpPolicy to requests and responses of one API
instance: CORS before the request is handled, cache headers and validators
after.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyCaching(io.javalin.http.Context context, ApiHttpPolicy policy) After-handler: cache headers, ETag and 304 for public reads; private, no-store for everything else.static voidapplyCors(io.javalin.http.Context context, ApiHttpPolicy policy) Before-handler: CORS headers.static booleanhasCredentials(io.javalin.http.Context context) Whether the request carries any credential QQQ would authenticate.static booleanifNoneMatchMatches(String ifNoneMatch, String etag) Weak comparison of an If-None-Match header against an entity tag (RFC 9110 13.1.2): any listed tag, ignoring the W/ prefix, or "*".static booleanisPublicRead(io.javalin.http.Context context) A GET or HEAD request without credentials.static StringweakEtag(byte[] body) Weak entity tag over the body: W/"base64url(first 16 bytes of SHA-256)".
-
Field Details
-
CACHE_CONTROL
- See Also:
-
CDN_CACHE_CONTROL
- See Also:
-
PRIVATE_NO_STORE
- See Also:
-
-
Method Details
-
hasCredentials
public static boolean hasCredentials(io.javalin.http.Context context) Whether the request carries any credential QQQ would authenticate. -
isPublicRead
public static boolean isPublicRead(io.javalin.http.Context context) A GET or HEAD request without credentials. -
applyCors
Before-handler: CORS headers. -
applyCaching
After-handler: cache headers, ETag and 304 for public reads; private, no-store for everything else. -
weakEtag
Weak entity tag over the body: W/"base64url(first 16 bytes of SHA-256)". -
ifNoneMatchMatches
-