Dispatcher Configuration to Cache Servlet Requests

Avatar

Avatar

pavanr6387218

Avatar

pavanr6387218

pavanr6387218

15-05-2018

Hi,

We have a requirement where in  we want to cache the servlet(AEM) response.

Servlet is making a REST call to third party to fetch a response which is constant(response remains same)

Response of the servlet to be cached:

Servlet :  /bin/servletpathname?queryParam=apiurl.

From clientside, we are making an ajax call to /bin/servletpathaname/apiurl/a.html (a.html is being appended so that the request has an extension.).

At Dispatcher We

are using internal redirect to redirect /bin/servletpathaname/apiurl/a.html  to /bin/servletpathname?queryParam=apiurl.

We are able to get a successful response back from servlet (Internal Redirect is successful). But at dispatcher we observe that the request is not getting cached.

Am I missing something?

I want to understand how can we cache the servlet response, this would greatly reduce the load on the end server and improve performance.

Dispatcher:

  • The request is a GET request
  • We have appended extension for the primary request.
  • No Query Param in the initial request
  • There is no authorization.

Dispatcher.any:

/rules
  {
    /0000  {  /glob "*"   /type "allow" }
  }

Replies

Highlighted

Avatar

Avatar

pavanr6387218

Avatar

pavanr6387218

pavanr6387218

17-05-2018

If the article changes(data changes from servlet changes), We are exposing another servlet which will be used to invalidate the cache.

Highlighted

Avatar

Avatar

vikask76191633

Avatar

vikask76191633

vikask76191633

18-12-2018

Is this question answered ? As I am also trying to do something similar however I am trying to cache service response.

URL: domain:port/services/servicename/apiname

This URL is a calls AEM servlet internally using httpclient and bring tons of data in json format, (static data).  Since it is taking a minute or more to return the response, I want to cache it at dispatcher.

How I can proceed with ?

Regards

Vikas