Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/httpcache request cookie extension #1683

Conversation

niekraaijmakers
Copy link
Contributor

Http cache config extension based on request cookie keys and values.

Allows you to create keys based on a cookie value. Useful for instance in the following scenario which is common:

Login to a middleware (AEM or otherwise) from the front-end
Login provides the user with a user type or group and saves this to the cookies.
Now we want to see different content (for example on a header menu list of links).

Here we can leverage the cookie value to show different content and cache it.

@update-changelog
Copy link

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update the CHANGELOG.md file with this pull request.

@coveralls
Copy link

coveralls commented Jan 13, 2019

Pull Request Test Coverage Report for Build 3668

  • 81 of 99 (81.82%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 47.176%

Changes Missing Coverage Covered Lines Changed/Added Lines %
bundle/src/main/java/com/adobe/acs/commons/httpcache/config/impl/RequestCookieHttpCacheConfigExtension.java 5 6 83.33%
bundle/src/main/java/com/adobe/acs/commons/httpcache/config/impl/keys/helper/RequestCookieKeyValueWrapperBuilder.java 17 18 94.44%
bundle/src/main/java/com/adobe/acs/commons/httpcache/config/impl/AbstractKeyValueExtension.java 15 17 88.24%
bundle/src/main/java/com/adobe/acs/commons/httpcache/config/impl/keys/helper/KeyValueMapWrapper.java 17 19 89.47%
bundle/src/main/java/com/adobe/acs/commons/httpcache/config/impl/keys/KeyValueHttpCacheKey.java 19 31 61.29%
Totals Coverage Status
Change from base Build 3659: 0.3%
Covered Lines: 11044
Relevant Lines: 23410

💛 - Coveralls

Niek Raaijmakers added 4 commits January 13, 2019 16:52
… this pattern will support key / value pairs based on more things such as request parameters, request headersvalue map values and more.
@niekraaijmakers
Copy link
Contributor Author

I made the approach more generic and extensible, so I can add a key/value key based on request headers, request parameters, value map values on the resource. Tested this locally and works fine.

@niekraaijmakers
Copy link
Contributor Author

niekraaijmakers commented Jan 14, 2019

example of usage (JMX)

@badvision badvision merged commit 656bc62 into Adobe-Consulting-Services:master Jan 14, 2019
@badvision badvision added this to the 4.0.0 milestone Jan 14, 2019
justinedelson pushed a commit that referenced this pull request Feb 6, 2019
* Fixed a bug regarding the cacheKeyFactory target

* RequestCookieExtension / key factory for HTTP cache

* Modified the request cookie http cache extension to be more generic - this pattern will support key / value pairs based on more things such as request parameters, request headersvalue map values and more.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants