response.addDateHeader("Expires", System.currentTimeMillis() + 86400000L); // expires in one day
response.addDateHeader("Last-Modified", file.lastModified());This example sets the value of the "Last-Modified" response header to the last modified timestamp of a file. This header is used by the browser to determine if a page has been updated and needs to be reloaded. This method is part of the javax.servlet.http package library, which is used for servlets that extend the functionality of web servers by generating dynamic content for web applications.