Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Experince Fragment Export as Javascript Module

Avatar

Level 2

Hi All,

We have requirement where we need to export XF as Js so that it will be use another NON-AEM to fetch the content.

Example:

http://localhost:4502/content/experience-fragments/maserati/xf/experience-fragment3/master.js 

it will display whole content of XF  and same we will refer to the other NON-AEM

 

is anyone worked on such type of requirement

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @test566 ,

Follow below steps

1.create the system user .

2 .creat the sling servlet in that create the session using service.

3.get the XF path using request object.

4.convert into the page object.

5 using bytecode array send to the request 

6.using bytecode you con convert into string

Thanks,

Sanjay 

 

View solution in original post

4 Replies

Avatar

Community Advisor

Hello @test566,

You can check this article, where it will meet your requirements: https://exadel.com/news/aem-experience-fragments-consuming-outside-aem/ 

From the external source, you can add it via,

 <div>External Content</div>
       <script src="http://localhost:4502/content/experience-fragments/maserati/xf/experience-fragment3/master.js"</script>
</div>

 

Avatar

Level 2

Hi @Sady_Rifat ,

Currently I am following the same but its giving error so that what i asked here if someone already implemented .

Thanks

Avatar

Community Advisor

Then if possible, please share the error, it will be more helpful to solve it.

Avatar

Correct answer by
Community Advisor

Hi @test566 ,

Follow below steps

1.create the system user .

2 .creat the sling servlet in that create the session using service.

3.get the XF path using request object.

4.convert into the page object.

5 using bytecode array send to the request 

6.using bytecode you con convert into string

Thanks,

Sanjay