cancel
Showing results for 
Search instead for 
Did you mean: 

Homepage with geo-location contents

marco_altieri
Star Contributor
Star Contributor
Hi,

I have to develop a site with WQS. A mandatory requirement is to have an homepage with contents based, for example, on geo-location.
This means that different users will see different contents in homepage.
Will the section cache deliver always the same contents ?
Should I use an ajax call (to an alfresco webscript) to retrieve the dynamic content?

Thanks,
Marco
5 REPLIES 5

bremmington
Champ on-the-rise
Champ on-the-rise
You certainly could make an Ajax call back to an Alfresco webscript, yes. Alternatively make it into a server-side component that you slot into a template - still calling back to a webscript in the repo. Either would work, as long as the information that you need to form the query is available on both tiers.

marco_altieri
Star Contributor
Star Contributor
Thank you very much Brian for your reply.

If I understand, the caches  (Website cache, Sections cache, Asset collection cache and Asset cache) don't store the html produced by the templates.
This means that It's not difficult to produce a different homepage for each user.
The content of the homepage should be based on cookies and so I'm thinking to customise the ApplicationDataInterceptor to store cookies in the requestContext:

        requestContext.setValue("cookies", request.getCookies());

I will use then this information in a custom template.

Thanks,
Marco

marco_altieri
Star Contributor
Star Contributor
Thank you for your reply.

If I understand, caches (Website cache, section cache, etc…) don't store the html produces by templates but only information like the section structure, collections of assets, asset attributes and contents. This means that it won't be difficult to have different contents for the homepage.

I'm thinking to use a custom
ApplicationDataInterceptor
to store in the
requestContext
the cookies:

        requestContext.setValue("cookies", request.getCookies());
I would like to use this information in custom templates to produce different html for the same page based on the cookies.

Thanks,
Marco

bremmington
Champ on-the-rise
Champ on-the-rise
Certainly that would work functionally, but be careful of performance implications. Generating a bespoke homepage for every user will mean that you won't be able to place a reverse proxy cache in front of it, so every request will come back to the web app tier. Depending how you implement that tier, you could end up with every request executing queries on the repo tier too. If this is going to be a busy site then you'll need to think carefully about what can be cached and where it can be cached.

marco_altieri
Star Contributor
Star Contributor
I'll try to ask a change of the requirements because having different content for the same url is also a problem for the SEO.

Even if every request will come back to the app tier, I don't think that, with the implementation that I would like to use, there will be calls to the back-end.

Anyway, I'm thinking to use the web module of ehcache customising the method calculateKey of SimplePageCachingFilter: the key will be the sum of the page url and a configured list of cookies.

Thank you very much for your help.
Marco
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.