Building an external HTML page from content stored in CQ | Community
Skip to main content
Level 3
October 16, 2015
Solved

Building an external HTML page from content stored in CQ

  • October 16, 2015
  • 5 replies
  • 1080 views

Hi All

CQ version 5.6

I have the following scenario. Content is authored and stored in my CQ instance.

Site A is using CQ and http://myUnsecuredSite/home/myCQPage.html will be deleivered by CQ. Straight forward scenario here

Now here is where things start getting a little bit complex

I want on my secure site “Site B” for page https://mySecuredSite/home/notCQPage.html to be able to display the content of the body of myCQPage.html. Only the header and the footer are different the rest of the content will be the same. This site will not be build in CQ

The question is how do I build my notCQPage.html with content stored in my CQ site ( site A) ? I also need to make sure that the header and footer is visually the only difference between myCQPage.html and notCQPage.html

Any guidance or suggestion is much appreciated

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Hi,

I would provide a "includecontent.jsp" on the template level, which just renders the body of the page, omitting the headers and footers. Then you can do a HTTP request to http://myUnsecuredSite/home/myCQPage.includecontent.html in your non-AEM application and insert the content there. I would place a dispatcher in front of the AEM instance to have these requests cached, which will save you lot of latency.

Jörg

5 replies

Lokesh_Shivalingaiah
Level 10
October 16, 2015

Hi,

Couple of ways here.

1. Directly do a JCR query to the page node and read the necessary parsys from 'Site B'

2. You can get json response and parse the content what you need.

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi,

I would provide a "includecontent.jsp" on the template level, which just renders the body of the page, omitting the headers and footers. Then you can do a HTTP request to http://myUnsecuredSite/home/myCQPage.includecontent.html in your non-AEM application and insert the content there. I would place a dispatcher in front of the AEM instance to have these requests cached, which will save you lot of latency.

Jörg

smacdonald2008
Level 10
October 16, 2015

As bsloki points out - you can get the HTML for a page located here:

[img]partext.png[/img]

aem_visiAuthor
Level 3
October 16, 2015

Thanks gents for the response

Can my "Site B" get the HTML live from the CQ repository i.e. by making an AJAX call to CQ sling servlet, or the latency will be too long to try and render the CQ content on page load of "Site B"

The other alternatives i guess will be 

1) CQ custom service to push published content(JSON/XML) on replication. My "site B" picks up the JSON of the newly published content from i.e. a relational database, or filesystem

2)  pull the published CQ content at certain intervals. The pulled content(JSON) is parsed and stored in a relational database. "Site B" is rendering content from the relational database

Any suggestion on which proposal could work?

smacdonald2008
Level 10
October 16, 2015

YOu can code a servlet to host in Site A. Then invoke it from the other site. The servlet can return JSON data after reading the JCR. However - this would be a custom servlet - it's not an outof the box feature.