private Message handleRequestWithIfModifiedSince(final Request request) throws IOException { final Path path = Path.fromUri(request.uri()); final Resource resource = resolveResource(path); try { String date = getOnlyElement(request.headers().get(IF_MODIFIED_SINCE)); Date ifModifiedSince = new SimpleDateFormat().parse(date); if (!ifModifiedSince.after(new Date()) && !(resource.lastModified().after(new Date()))) { return redirectionNotModified(); } else { return handleRequestWithoutIfModifiedSince(request); } } catch (ParseException e) { return handleRequestWithoutIfModifiedSince(request); } }