11 Replies Latest reply on Mar 15, 2012 8:37 PM by Shelly Goel

    Retrieving specific node content from an external JSP

    Murali Vusthipalli Level 1

      I have a requirement to pull specific content from a CQ page on publish instance from an external JSP running in a Java web app.

       

      For example: The products page in Geometrixx Out doors in CQ5.5: http://localhost:4502/cf#/content/geometrixx/en/products.html. In CRX, under /content/geometrixx/en/products/jcr:content/par, there are title_1, title1 etc., If we type the URL as http://localhost:4502/content/geometrixx/en/products/jcr:content/par/title_1.html, the result is "Our Best Sellers" and if we type http://localhost:4502/content/geometrixx/en/products/jcr:content/par/title1.html, the result is "Square". If the external JSP code requires the title-Square on the products page, I need to know the exact node name-title1 in the URL to retrive the content(Square).

       

      What is the logic in my JSP for getting the specific content of a node?

        • 1. Re: Retrieving specific node content from an external JSP
          hypnotec Adobe Employee

          you don't know the "internal" resource names of the titles added by authors from outside. authors can change the order of titles or delete them. but you have various options:

           

          1) return the paragraph system (e.g. http://localhost:4503/content/geometrixx/en/jcr:content/par.1.json) as JSON and look for the first sling:resourceType property with the expected title resource type

           

          "title_1":{"jcr:lastModifiedBy":"admin","sling:resourceType":"geometrixx/components/title" ,"jcr:createdBy":"admin","jcr:title":"Strategic Consulting","jcr:created":"Mon Aug 23 2010 22:12:08 GMT+0200","jcr:lastModified":"Wed Oct 27 2010 21:33:24 GMT+0200","jcr:primaryType":"nt:unstructured"}

           

          2) parse the parsys HTML for the first <div class="... title ...">

           

          ...

          • 2. Re: Retrieving specific node content from an external JSP
            Murali Vusthipalli Level 1

            Rather than serving the production web site by CQ/CRX, the idea is to have an external J2EE web app serving the customers, which will pull the content from CQ/CRX.

             

            What are your comments with this approach? Also, will we loose any CQ features: Omniture integration such as SiteCatalysts, Test&Target etc., by adopting to the above architecture?

            • 3. Re: Retrieving specific node content from an external JSP
              hypnotec Adobe Employee

              this sounds very much like a portal approach. portal approach is rather stone age nowadays. integrating into the portal requires extra development overhead to have all features run smoothly in the context of the portal site (as you mention: client context, tracking, test & target).

               

              nevertheless, CQ has a portal director feature for such purposes.

              • 4. Re: Retrieving specific node content from an external JSP
                Murali Vusthipalli Level 1

                Thank you so much for your answers.

                 

                Is there any specific documentation related to protal director feaure?

                • 5. Re: Retrieving specific node content from an external JSP
                  Davide G Adobe Employee

                  I think this could be a good starting point http://goo.gl/oxyYb

                   

                  I personally never tried.

                   

                  Davide.

                  • 6. Re: Retrieving specific node content from an external JSP
                    Murali Vusthipalli Level 1

                    Thank you for your patient answers. They are really helpful.

                     

                    One last question: By following the below approach(CQ is not serving the web site and it's just sourcing the content to the web application): can we achieve all the CQ features still or will we be missing some of the features such as analytics, test&target etc.,? Yes, I understand that CQ portal director approach will need lot of extra development, but I am wondering about the implications of doing the below.

                     

                    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                    you don't know the "internal" resource names of the titles added by authors from outside. authors can change the order of titles or delete them. but you have various options:

                     

                    1) return the paragraph system (e.g. http://localhost:4503/content/geometrixx/en/jcr:content/par.1.json) as JSON and look for the first sling:resourceType property with the expected title resource type

                     

                    "title_1":{"jcr:lastModifiedBy":"admin","sling:resourceType":"geometri xx/components/title","jcr:createdBy":"admin","jcr:title":"Strategic Consulting","jcr:created":"Mon Aug 23 2010 22:12:08 GMT+0200","jcr:lastModified":"Wed Oct 27 2010 21:33:24 GMT+0200","jcr:primaryType":"nt:unstructured"}

                     

                    2) parse the parsys HTML for the first <div class="... title ...">

                    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                     


                    • 7. Re: Retrieving specific node content from an external JSP
                      hypnotec Adobe Employee

                      the JSON approach i gave you before realizing the portal context. of course if you dump page data as JSON you don't have any of the features active, such as test & target, as they are brought alive through HTML/JS/CSS rendering et al.

                      1 person found this helpful
                      • 8. Re: Retrieving specific node content from an external JSP
                        Murali Vusthipalli Level 1

                        Thanks for your patient answers, hypnotec.

                        • 9. Re: Retrieving specific node content from an external JSP
                          Shelly Goel Level 1

                          We have a similar requirement in our project where CQ is not the presentation layer. Here, we are breaking the actual web app page into small chunks (content spots) and these will be created in CQ as separate pages. Extract the html code from these CQ pages and put them in web server as html files. App server JSP will then include these where required.

                           

                          For test & target - Use the same css/js in CQ as used in actuall web app so that the CQ preview looks exactly same. Also, we have given the url of the actual web page (one that is including this content) in sidekick so that we can preview the same content as it will be shown in live site.

                           

                          For web analytics - We are providing the analytics tags and other metadata information in a separate file (e.g xml) tagging it alongwith the content spot.

                           

                          For extracting the content - create HTTP URL connection to the par.html of that cq page and get the input stream to store in an HTML file to be given to web app.

                          • 10. Re: Retrieving specific node content from an external JSP
                            honey1259 Level 1

                            For test & target - Use the same css/js in CQ as used in actuall web app so that the CQ preview looks exactly same. Also, we have given the url of the actual web page (one that is including this content) in sidekick so that we can preview the same content as it will be shown in live site.

                             

                            Q (1): When CQ preview look the same as the application preview, what is the importance of the including the url in the sidekick?

                            Q (2): Do adding the url to the sidekick involve customization. I was assuming that customizing the sidekick is not a recommended idea?

                            • 11. Re: Retrieving specific node content from an external JSP
                              Shelly Goel Level 1

                              (1) Yes the CQ preview will be same but it is a standalone content in CQ. For a better judgement of how the content will actually show up in live site, we should also have an option to see how it will look when it is actually used alongwith other dynamic data - kind of integration preview. This will help to know the issues in advance rather than finding them in last step (after publishing, etc.)

                              (2) It is not about altering the existing functionality of sidekick, we are just enhancing/ adding one more action to the sidekick. This will help in enhancing the author experience and finding the issues asap.