Expand my Community achievements bar.

Dispatcher Configuration to Cache Servlet Requests

Avatar

Level 2

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" }
  }
12 Replies