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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Caching response from servlet

Jai1122
Level 5
Level 5

Hi Experts,

  We have two ways of registering a sling servlet

  1. Registering through path
  2. Registering through resource type.

Say we use the second option, I have a page component /sampleproject/page/homepagecomponent and i register a servlet using this component. This means whenever i access a page created using this component(/content/home.html) the servlet will get invoked and the response from the servlet will be used to render the page. It does not matter whether the call is from the browser or it is an Ajax call. 

If my above understanding is correct can we cache the response from the servlet in dispatcher through this option? Usually say we use something like /bin/myservlet as path for servlet, in disptacher we will allow this path to hit the publish instance and we will not cache it. I am trying to cache the response from the servlet as well. Please help me with your inputs.

Thanks,

Jai.

1 Accepted Solution
Feike_Visser1
Correct answer by
Employee
Employee

You can only cache responses that have an extension.

See here more detailed info: https://docs.adobe.com/content/docs/en/dispatcher.html

View solution in original post

2 Replies
Feike_Visser1
Correct answer by
Employee
Employee

You can only cache responses that have an extension.

See here more detailed info: https://docs.adobe.com/content/docs/en/dispatcher.html

View solution in original post

Jitendra_S_Toma
Level 9
Level 9

Hi,

That's one way to cache the response from servlet. Another way is that you have to use /bin/servlet.json or html and also allowed this path at the dispatcher level.

Regards,

Jitendra