// The external context gives access to the servlet environment var exCon = facesContext.getExternalContext(); // The writer is the closest you get to a PRINT statement // If you need to output binary data, use the stream instead var writer = facesContext.getResponseWriter(); // The servlet's response, check the J2EE documentation what you can do var response = exCon.getResponse(); // In this example we want to deliver xml and make sure it doesn't get cached response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); // Here all your output will be written writer.write("<?xml version="1.0" encoding="UTF-8"?>n<christmas date"24Dec" />"); // We tell the writer we are through writer.endDocument(); facesContext.responseComplete();
response.setHeader("Cache-Control", "no-cache");
var now = new Date(); response.setDateHeader("Expires", now.getTime() + (30*24*60*60*1000)); response.setHeader("Cache-Control", "public");
thanks