Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Do we have any substitute for com.day.cq.contentsync.handler.util.RequestResponseFactory , this is deprecated ?

Avatar

Level 1
Level 1
 
1 Accepted Solution

Avatar

Correct answer by
Employee Advisor
7 Replies

Avatar

Community Advisor

Hi @kjj ,

Yes, the com.day.cq.contentsync.handler.util.RequestResponseFactory class is deprecated in AEM. The recommended substitute for this class is to use the org.apache.sling.api.request.RequestResponseFactory interface instead. To obtain an instance of the RequestResponseFactory interface, you can use the org.apache.sling.api.SlingHttpServletRequest object.

Avatar

Employee

Hey @MayurSatav can you just recheck or tell me how you found the api, i cannot find it, giving a snap from IDE, share me also the java-doc link for the same (org.apache.sling.api.request.RequestResponseFactor)

Rajarshi306278674zn4_0-1687408301987.png

 

 

Avatar

Level 1

Hi @MayurSatav 

Such an 

 org.apache.sling.api.request.RequestResponseFactory 

interface does not exist. Can you please confirm the right replacement?

Avatar

Community Advisor

Hi @kjj 

What is the reason you are using "RequestResponseFactory" API, I suggest if it is just to create request , you can get it directly from SlingHttpServletRequest.
Let me know if you have any other specific reason?


Avatar

Level 2

my reason for using it is to get the generated html for my component, 

 

the above person Mayur say use SlingHttpServletRequest request to get the RequestResponseFactory, how can that be done? i cant find any method in SlingHttpServletRequest that return the RequestResponseFactory

Avatar

Correct answer by
Employee Advisor

Check https://sling.apache.org/documentation/bundles/servlet-helpers.html, it explains the tools Sling provides for this.