Package org.a2aproject.sdk.server
Class AgentCardCacheMetadata
java.lang.Object
org.a2aproject.sdk.server.AgentCardCacheMetadata
Provides HTTP caching metadata for Agent Card responses.
This bean computes and caches HTTP caching headers (Cache-Control, ETag, Last-Modified) for the Agent Card endpoint as specified in the A2A protocol specification section 8.6.
The metadata is computed once at initialization:
- Cache-Control: Configured via
a2a.agent-card.cache.max-age(default: 3600 seconds) - ETag: MD5 hash of the serialized Agent Card JSON
- Last-Modified: Timestamp when the bean was initialized (RFC 1123 format)
Since the Agent Card is @ApplicationScoped, these values remain stable
throughout the application lifecycle unless the application is restarted.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAgentCardCacheMetadata(AgentCard agentCard, A2AConfigProvider config) Public constructor for testing purposes. -
Method Summary
Modifier and TypeMethodDescriptionReturns the Cache-Control header value for the Agent Card.getETag()Returns the ETag header value for the Agent Card.Populates a map with header names and header values stored in this instance.Returns the Last-Modified header value for the Agent Card.
-
Constructor Details
-
AgentCardCacheMetadata
Public constructor for testing purposes.- Parameters:
agentCard- the agent cardconfig- the configuration provider
-
-
Method Details
-
getETag
Returns the ETag header value for the Agent Card.The ETag is an MD5 hash of the serialized Agent Card JSON, quoted per HTTP specification.
- Returns:
- the ETag header value (e.g.,
"a1b2c3d4...")
-
getLastModified
Returns the Last-Modified header value for the Agent Card.The timestamp represents when the bean was initialized, in RFC 1123 format.
- Returns:
- the Last-Modified header value (e.g.,
"Mon, 17 Mar 2025 10:00:00 GMT")
-
getCacheControl
Returns the Cache-Control header value for the Agent Card.The value includes
publicand amax-agedirective configured viaa2a.agent-card.cache.max-age(default: 3600 seconds).- Returns:
- the Cache-Control header value (e.g.,
"public, max-age=3600")
-
getHttpHeadersMap
Populates a map with header names and header values stored in this instance.- Returns:
- a map of the headers
-