PHP Class Helthe\Component\Turbolinks\Turbolinks

显示文件 Open project: helthe/turbolinks Class Usage Examples

Public Methods

Method Description
decorateResponse ( Request $request, Response $response ) Modifies the HTTP headers and status code of the Response so that it can be properly handled by the Turbolinks javascript.

Private Methods

Method Description
addRequestMethodCookie ( Request $request, Response $response ) Adds a cookie with the request method for non-GET requests. If a cookie is present and the request is GET, the cookie is removed to work better with caching solutions. The turbolinks will not initialize if the cookie is set.
canHandleRedirect ( Request $request ) : boolean Checks if the request can handle a Turbolink redirect. You need to have a session and a XHR request header to handle a redirect.
getUrlOrigin ( string $url ) : array Parse the given url into an origin array with the scheme, host and port.
haveSameOrigin ( Request $request, Response $response ) : boolean Checks if the request and the response have the same origin.
modifyStatusCode ( Request $request, Response $response ) Modifies the response status code. Checks for cross domain redirects and blocks them.

Method Details

decorateResponse() public method

Modifies the HTTP headers and status code of the Response so that it can be properly handled by the Turbolinks javascript.
public decorateResponse ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response