Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

caching and .forward  RSS feed

 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm currently working with an Model-View-Controller (MVC) where the Servlet (controller) is setting some attributes on the request then .forwarding to the JSP (view).
Typically a .forward results in the request and response being retained, but if any data was sent to the client (and is still held in the buffer) then this data is purged.
The servlet (actually the servlet superclass) is writing some "don't cache this" information to the request object, but will this data survive the .forward purge or will it be cleared?
Dave.
(normally I'd write a fake request and trap it to see if it still contains the required header info, but I'm at the clients site, not on my own machine...)
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So sometime you answer your own question first...
The answer is 'Yes', everything works OK.
The data set in the servlet is still passed to the client and is not lost during the forward operation when the buffer is cleared.
Dave.
(oh, and I did of couse mean that I was setting the cache control stuff on the response, not the request )
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!