W3cubDocs

/Symfony 4.1

Esi

class Esi extends AbstractSurrogate

Esi implements the ESI capabilities to Request and Response instances.

For more information, read the following W3C notes:

  • ESI Language Specification 1.0 (http://www.w3.org/TR/esi-lang)

  • Edge Architecture Specification (http://www.w3.org/TR/edge-arch)

Properties

protected $contentTypes from AbstractSurrogate
protected $phpEscapeMap from AbstractSurrogate

Methods

__construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml')) from AbstractSurrogate
ResponseCacheStrategyInterface createCacheStrategy()

Returns a new cache strategy instance.

from AbstractSurrogate
bool hasSurrogateCapability(Request $request)

Checks that at least one surrogate has Surrogate capability.

from AbstractSurrogate
addSurrogateCapability(Request $request)

Adds Surrogate-capability to the given Request.

from AbstractSurrogate
bool needsParsing(Response $response)

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

from AbstractSurrogate
string handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors)

Handles a Surrogate from the cache.

from AbstractSurrogate
removeFromControl(Response $response)

Remove the Surrogate from the Surrogate-Control header.

from AbstractSurrogate
string getName()

Returns surrogate name.

addSurrogateControl(Response $response)

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

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

Renders a Surrogate tag.

Response process(Request $request, Response $response)

Replaces a Response Surrogate tags with the included resource content.

Details

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

Parameters

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

ResponseCacheStrategyInterface createCacheStrategy()

Returns a new cache strategy instance.

Return Value

ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance

bool hasSurrogateCapability(Request $request)

Checks that at least one surrogate has Surrogate capability.

Parameters

Request $request

Return Value

bool true if one surrogate has Surrogate capability, false otherwise

addSurrogateCapability(Request $request)

Adds Surrogate-capability to the given Request.

Parameters

Request $request

bool needsParsing(Response $response)

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

Parameters

Response $response

Return Value

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

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

Handles a Surrogate from the cache.

Parameters

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

Return Value

string

Exceptions

RuntimeException
Exception

protected removeFromControl(Response $response)

Remove the Surrogate from the Surrogate-Control header.

Parameters

Response $response

string getName()

Returns surrogate name.

Return Value

string

addSurrogateControl(Response $response)

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

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

Parameters

Response $response

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

Renders a Surrogate tag.

Parameters

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

Return Value

string

Response process(Request $request, Response $response)

Replaces a Response Surrogate tags with the included resource content.

Parameters

Request $request
Response $response

Return Value

Response

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/HttpKernel/HttpCache/Esi.html