Description: The setDateHeader() method sets a header with the given name and date-value in the HTTP response.
Syntax: public void setDateHeader(String headerName, long dateValue)
Example 1: This example sets the Last-Modified header with the current date and time, indicating that the resource was last modified at the current time.
response.setDateHeader("Last-Modified", new Date().getTime());
Example 2: This example sets the Expires header to 1 hour from now, indicating that the resource should not be cached for more than 1 hour.
Date expires = new Date(System.currentTimeMillis() + 3600 * 1000); response.setDateHeader("Expires", expires.getTime());
Package Library: javax.servlet.http. This package provides classes and interfaces for HTTP servlets.
Java HttpServletResponse.setDateHeader - 30 examples found. These are the top rated real world Java examples of javax.servlet.http.HttpServletResponse.setDateHeader extracted from open source projects. You can rate examples to help us improve the quality of examples.