This repository was archived by the owner on Sep 3, 2026. It is now read-only.
Conversation
added 2 commits
September 27, 2016 17:11
Makes it easier to enable HttpCache controllers, and increases extensibility.
Meant as a proxy of REST controllers. If a method returns a CachedValue object, it logs a deprecation notice, and unwraps the value from the cached object.
bdunogier
force-pushed
the
ezp26297-rest_embedding_http_cache_integration
branch
2 times, most recently
from
September 29, 2016 22:36
9be4a0b to
6dcd26f
Compare
added 13 commits
October 1, 2016 00:20
…lue object fixup! EZP-25696: Allow 'path' cache tag in CachedValue object
When a resource is embedded: - adds the X-eZ-Embed-Value header - adds the cache tags from the embedded object to the response
Allows multiple run of the REST tests without resetting the database.
bdunogier
force-pushed
the
ezp26297-rest_embedding_http_cache_integration
branch
from
October 4, 2016 15:13
6dcd26f to
7b42078
Compare
Contributor
|
This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below: Loaded config from "/jenkins/jenkins.std/jobs/PAPI-Pull-Request-code-sniffer/workspace/.php_cs"
..............................................................F..FF............................................................................................................................................................................................................................................................................................................................................................................................
Legend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error
1) eZ/Bundle/EzPublishRestBundle/Tests/Functional/ContentTypeTest.php (multiline_array_trailing_comma, return, braces)
---------- begin diff ----------
--- Original
+++ New
@@ @@
);
-
@@ @@
);
+
@@ @@
'identifier' => $row['identifier'],
- 'fieldDefinitions' => []
+ 'fieldDefinitions' => [],
@@ @@
);
+
@@ @@
'id' => $struct['ContentTypeGroup']['id'],
- 'identifier' => $struct['ContentTypeGroup']['identifier']
+ 'identifier' => $struct['ContentTypeGroup']['identifier'],
@@ @@
'identifier' => $struct['ContentType']['identifier'],
- 'fieldDefinitions' => []
+ 'fieldDefinitions' => [],
]
);
}
private function parseContentTypeListFromRespose($response)
{
}
}
---------- end diff ----------
2) eZ/Bundle/EzPublishRestBundle/Tests/Functional/UrlAliasTest.php (multiline_array_trailing_comma, parenthesis, elseif)
---------- begin diff ----------
--- Original
+++ New
@@ @@
- self::assertHttpResponseCodeEquals( $response, 204 );
+ self::assertHttpResponseCodeEquals($response, 204);
@@ @@
$responseStruct['UrlAliasRefList']['UrlAlias']
- )
+ ),
@@ @@
$id = $part;
- } else if (isset($id)) {
+ } elseif (isset($id)) {
return $id;
}
}
}
/**
* @param Response $response
* @return URLAlias
*/
private function parseUrlAliasFromResponse(Response $response)
{
$responseStruct = json_decode($response->getContent(), true);
return new URLAlias(
[
'id' => $responseStruct['UrlAlias']['_id'],
'destination' => new Location(['id' => $this->extractLastIdFromHref($responseStruct['UrlAlias']['location']['_href'])]),
]
);
}
}
---------- end diff ----------
3) eZ/Bundle/EzPublishRestBundle/Tests/Functional/BinaryContentTest.php (return, unused_use)
---------- begin diff ----------
--- Original
+++ New
@@ @@
use eZ\Bundle\EzPublishRestBundle\Tests\Functional\TestCase as RESTFunctionalTestCase;
-use eZ\Publish\SPI\Variation\Values\ImageVariation;
@@ @@
XML;
+
return $this->createContent($xml);
}
}
---------- end diff ----------
Fixed all files in 494.045 seconds, 26.250 MB memory used |
Contributor
Author
|
Replaced by http://github.com/ezsystems/ezplatform-http-cache. do not delete the branch yet |
Closed
2 tasks
Member
|
Closing PR as obsolete. eZ Platform 2.5 has reached EOM, so please reopen PR in ezsystems/ezplatform-kernel (bug fixes) or ibexa/core (features/improvements) if issue is still valid for v3.3 / v4.x and you are willing to work on it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change integrates HTTP cache multi-tagging to the eZ Platform REST API. Multi-tagging allows responses to be tagged (ex:
content-42,location-300,content-type-15, ...). Those tags can be used to purge cached resources matching a given tag. This is done by the Public API when an operation modifies the repository.The REST controllers return
CachedValueobjects, with cache tags.The main challenge is to make sure that the tags of any embedded resource are part of the main response's answer. The
ResourceLinkvisitor, used by REST embedding, loads embedded content using the controllers, and adds any cache tag to the response.Implementation changes
HttpCache layer refactored to proxy controllers
Generation of
CachedValueobjects is moved out of the REST controllers. They got pretty large already. Instead, caching is implemented as for the persistence layer. Each controller has anHttpCacheequivalent. They forward every action to the actual controller, and wrap the response in aCachedValueobject, with the tags.The cache controllers are enabled in
EzPublishRestExtension.As some actions were already returning
CachedValueobjects, aCachedValueUnwrapperControllerhas been added:REST\Server\HttpCache\LocationControllerREST\Server\HttpCache\CachedValueUnwrapperControllerREST\Server\Controller\LocationIt will any wrapped value
CachedValue, and if it did, throw a deprecation notice about it.TODO