Class CombineResponse
java.lang.Object
org.frontcache.include.combine.CombineResponse
The origin's half of the combine contract: build and write the response envelope.
See docs/archive/combine-reduce-proposal.md section 6.
Parts must be added in the order the members arrived -
parts[i] answers
fc-part-i. writeTo(HttpServletResponse) is what sets the x-frontcache-combine header, which
is the only signal the edge has that the origin understood the request at all; an origin that
writes the JSON by hand and forgets that header will be treated as not implementing combining.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA part with no echo, no explicit status and no headers - i.e.A part with cache directives.addComponent(String q, String body, String maxAge, String tags) A cacheable part, spelled the way the<fc:component>tag spells it.A member the origin could not render.intsize()toJson()voidwriteTo(jakarta.servlet.http.HttpServletResponse response) Writes the envelope: content type, thex-frontcache-combinesupport signal, an explicit content length, and the JSON body.
-
Constructor Details
-
CombineResponse
public CombineResponse()
-
-
Method Details
-
add
A part with no echo, no explicit status and no headers - i.e. an uncacheable 200 fragment. -
add
-
add
-
addComponent
A cacheable part, spelled the way the<fc:component>tag spells it.- Parameters:
q- echo of this member's query string, or null to omit itbody- the fragmentmaxAge-x-frontcache-component-maxage, e.g."10d"; null means not cacheabletags-x-frontcache-component-tags, e.g."coin|coin-42"; null to omit
-
addError
A member the origin could not render. Not cached by the edge; that member falls back. -
size
public int size() -
getEnvelope
-
toJson
- Throws:
IOException
-
writeTo
Writes the envelope: content type, thex-frontcache-combinesupport signal, an explicit content length, and the JSON body. The length is set explicitly because the body is already fully in hand - letting the container fall back to chunked encoding for a response whose size is known costs the edge a read-until-EOF where it could have read a known number of bytes.- Throws:
IOException
-