Set cache headers on an XPage

var exCon = facesContext.getExternalContext(); 
var writer = facesContext.getResponseWriter(); 
var response = exCon.getResponse(); 

//set the expires header to 30 days after now 
var now = new Date(); 
response.setDateHeader("Expires", now.getTime() + (30*24*60*60*1000)); 
response.setHeader("Cache-Control", "public"); 

//sample: send some JavaScript to the browser
response.setHeader("Content-Type", "application/x-javascript"); 
writer.write( "var foo = \"bar\";" ); 

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...