Exposing the full content path using AJAX get request | Community
Skip to main content
Level 3
October 16, 2015
Solved

Exposing the full content path using AJAX get request

  • October 16, 2015
  • 3 replies
  • 797 views

We want to call a servlet using an AJAX GET request. Our servlet path is something like /content/test/jcr:content/par-main/events_calendar.events.json. We use resource type as a way of resolving the servlet so we can read properties from the component within the servlet itself.

Is there a way to prevent exposing the full content structure in the HTML/Javascript?

Is it considered OK to expose - /content/test0/jcr:content/par-main/ in our HTML?

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,

When your page is at https://hostname/home/mypage.html, I would do the AJAX request on https://hostname/home/mypage.events.json. Don't expose the internal repo path.

kind regards,
Jörg

3 replies

Community Advisor
October 16, 2015

If you are using web server, you may be able to do it using mod_rewrite. You need to write  rules in apache configuration, you may have to call the path defined in rules.

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

Hi,

When your page is at https://hostname/home/mypage.html, I would do the AJAX request on https://hostname/home/mypage.events.json. Don't expose the internal repo path.

kind regards,
Jörg

Level 3
October 16, 2015

Jörg Hoh wrote...

Hi,

When your page is at https://hostname/home/mypage.html, I would do the AJAX request on https://hostname/home/mypage.events.json. Don't expose the internal repo path.

kind regards,
Jörg

 

I totally agree hiding the path e.g. /content/my-site/en should be done. But hiding the path from the page downwards e.g. my-page/jcr-content/par-main/events.calendar.json - is this required?

A lot of AJAX examples I have seen don't seem to be hiding this path - Example - http://labs.sixdimensions.com/blog/2013-09-16/using-ajax-cq-components/

$.get("/my-page/jcr:content/my-component.{selector}.html?{url-param}={param-value}") .success(function(data){ $("component-id").replaceWith($(data)); });