Caching response from servlet | Community
Skip to main content
Jai1122
Level 4
December 1, 2016
Solved

Caching response from servlet

  • December 1, 2016
  • 2 replies
  • 2374 views

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.

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 Feike_Visser1

You can only cache responses that have an extension.

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

2 replies

Feike_Visser1
Adobe Employee
Feike_Visser1Adobe EmployeeAccepted solution
Adobe Employee
December 1, 2016

You can only cache responses that have an extension.

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

Jitendra_S_Toma
Level 10
December 1, 2016

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