Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Exposing the full content path using AJAX get request

Avatar

Level 4

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?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

0 Replies

Avatar

Level 9

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.

Avatar

Correct answer by
Employee Advisor

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

Avatar

Level 4

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)); });