Class

Symfony\Component\HttpKernel\HttpCache\Esi

class Esi

Esi implements the ESI capabilities to Request and Response instances.

For more information, read the following W3C notes:

Methods

__construct(array $contentTypes = array('text/html', 'text/xml', 'application/xml'))

Constructor.

EsiResponseCacheStrategyInterface createCacheStrategy()

Returns a new cache strategy instance.

Boolean hasSurrogateEsiCapability(Request $request)

Checks that at least one surrogate has ESI/1.0 capability.

addSurrogateEsiCapability(Request $request)

Adds ESI/1.0 capability to the given Request.

addSurrogateControl(Response $response)

Adds HTTP headers to specify that the Response needs to be parsed for ESI.

Boolean needsEsiParsing(Response $response)

Checks that the Response needs to be parsed for ESI tags.

renderIncludeTag(string $uri, string $alt = null, Boolean $ignoreErrors = true, string $comment = '')

Renders an ESI tag.

process(Request $request, Response $response)

Replaces a Response ESI tags with the included resource content.

handle(HttpCache $cache, string $uri, string $alt, Boolean $ignoreErrors)

Handles an ESI from the cache.

Details

at line 39
public __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xml'))

Constructor.

Parameters

array $contentTypes An array of content-type that should be parsed for ESI information. (default: text/html, text/xml, and application/xml)

at line 49
public EsiResponseCacheStrategyInterface createCacheStrategy()

Returns a new cache strategy instance.

Return Value

EsiResponseCacheStrategyInterface A EsiResponseCacheStrategyInterface instance

at line 61
public Boolean hasSurrogateEsiCapability(Request $request)

Checks that at least one surrogate has ESI/1.0 capability.

Parameters

Request $request A Request instance

Return Value

Boolean true if one surrogate has ESI/1.0 capability, false otherwise

at line 75
public addSurrogateEsiCapability(Request $request)

Adds ESI/1.0 capability to the given Request.

Parameters

Request $request A Request instance

at line 90
public addSurrogateControl(Response $response)

Adds HTTP headers to specify that the Response needs to be parsed for ESI.

This method only adds an ESI HTTP header if the Response has some ESI tags.

Parameters

Response $response A Response instance

at line 104
public Boolean needsEsiParsing(Response $response)

Checks that the Response needs to be parsed for ESI tags.

Parameters

Response $response A Response instance

Return Value

Boolean true if the Response needs to be parsed, false otherwise

at line 121
public renderIncludeTag(string $uri, string $alt = null, Boolean $ignoreErrors = true, string $comment = '')

Renders an ESI tag.

Parameters

string $uri A URI
string $alt An alternate URI
Boolean $ignoreErrors Whether to ignore errors or not
string $comment A comment to add as an esi:include tag

at line 142
public process(Request $request, Response $response)

Replaces a Response ESI tags with the included resource content.

Parameters

Request $request A Request instance
Response $response A Response instance

at line 186
public handle(HttpCache $cache, string $uri, string $alt, Boolean $ignoreErrors)

Handles an ESI from the cache.

Parameters

HttpCache $cache An HttpCache instance
string $uri The main URI
string $alt An alternative URI
Boolean $ignoreErrors Whether to ignore errors or not