November 2017
Intermediate to advanced
420 pages
10h 29m
English
You can use the Expires HTTP header field to let all entities involved in the request-response chain know when a resource has expired. The Expires HTTP header was defined as part of the HTTP/1.0 specification. You can specify the date and time in the Expires header, after which the resource fetched from the server is considered stale.
The following code snippet shows how you can add the Expires HTTP header to the resource returned by the method:
@GET
@Path("departments/{id}/holidays")
@Produces(MediaType.APPLICATION_JSON)
public Response getHolidayListForCurrentYear(@PathParam("id") Short deptId) { //Reads the list of holidays List<Date> holidayList = getHolidayListForDepartment(deptId); ...