What method would you use to set the expiration date of a servlet response as a specific date and time?
- response.setDateHeader("Expires", System.currentTimeMillis() + 86400000);
- response.setExpirationDate("2024-12-31T23:59:59");
- response.setExpirationTime("2024-12-31T23:59:59");
- response.setExpires("2024-12-31T23:59:59");
The response.setDateHeader("Expires", System.currentTimeMillis() + 86400000); method is used to set the expiration date of a servlet response to a specific date and time.
Loading...
Related Quiz
- When no connections are available in the pool, the request is put into a __________ until a connection becomes available.
- If a filter needs to perform different actions based on the type of HTTP request, which method or object should it use to determine this?
- The method __________ is used to handle request and response objects in a filter.
- What is the primary purpose of the POST method in HTTP?
- If a servlet generates dynamic content and you want to ensure it's not cached, which combination of response headers should be set?