HttpCache\Ssi (Component\HttpKernel)

Symfony\Component\HttpKernel\HttpCache\Ssi

class Ssi implements SurrogateInterface

Ssi implements the SSI capabilities to Request and Response instances.

Methods

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

Constructor.

string getName()

Returns surrogate name.

ResponseCacheStrategyInterface createCacheStrategy()

Returns a new cache strategy instance.

bool hasSurrogateCapability(Request $request)

Checks that at least one surrogate has Surrogate capability.

addSurrogateCapability(Request $request)

Adds Surrogate-capability to the given Request.

addSurrogateControl(Response $response)

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

bool needsParsing(Response $response)

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

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.

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

Handles a Surrogate from the cache.

Details

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

Constructor.

Parameters

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

public string getName()

Returns surrogate name.

Return Value

string

public ResponseCacheStrategyInterface createCacheStrategy()

Returns a new cache strategy instance.

Return Value

ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance

public bool hasSurrogateCapability(Request $request)

Checks that at least one surrogate has Surrogate capability.

Parameters

Request $request A Request instance

Return Value

bool true if one surrogate has Surrogate capability, false otherwise

public addSurrogateCapability(Request $request)

Adds Surrogate-capability to the given Request.

Parameters

Request $request A Request instance

public 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 A Response instance

public bool needsParsing(Response $response)

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

Parameters

Response $response A Response instance

Return Value

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

public 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

public Response process(Request $request, Response $response)

Replaces a Response Surrogate tags with the included resource content.

Parameters

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

Return Value

Response

public 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

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/HttpKernel/HttpCache/Ssi.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部