Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Configure caching

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was reading that I could add <controller nocache="true"/> in my struts-config.xml file. Struts would modify each response header as follows:

response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 1);

My question is where would I add the <controller nocache="true"/> element. I already have a controller element i.e.

<controller>
<set-property property="processorClass" value="com.td.idcs.action.SessionFilter"/>
</controller>

and I placed <controller nocache="true"/> above it but that produced no results. Can someone please help.

Thank you for your time.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can only one controller element in struts-config.xml. Add the attribute or element for "nocache=true". Since you have custom controller class, guess it is extending standard RequestProcessor. You need to ensure that processNoCache() method is invoked.
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I now included no cache to controller element nocache="true. I also included

protected void processNoCache(HttpServletRequest request, HttpServletResponse response){
super.processNoCache(request, response);
}

in my controller class, but it doesnt produce the expected result.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what is problem. You can do a simple check on response object to see if the header's has been set. Is it setting the no-cache meta attribute on response header?
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry ignore my last post it works. thank you very much for your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic