revised DispatcherServlet's last-modified handling to properly work with scoped controllers; added HEAD support to ResourceHttpRequestHandler

This commit is contained in:
Juergen Hoeller
2010-08-12 22:54:24 +00:00
parent 29b12adbaa
commit f6c07b371f
4 changed files with 54 additions and 93 deletions

View File

@@ -186,7 +186,7 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
long ifModifiedSince = getRequest().getDateHeader(HEADER_IF_MODIFIED_SINCE);
this.notModified = (ifModifiedSince >= (lastModifiedTimestamp / 1000 * 1000));
if (this.response != null) {
if (this.notModified) {
if (this.notModified && "GET".equals(getRequest().getMethod())) {
this.response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
}
else {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ public interface WebRequest extends RequestAttributes {
/**
* Return the request header of the given name, or <code>null</code> if none.
* <p>Retrieves the first header value in case of a multi-value header.
* @since 3.0
* @see javax.servlet.http.HttpServletRequest#getHeader(String)
*/
String getHeader(String headerName);
@@ -43,14 +44,15 @@ public interface WebRequest extends RequestAttributes {
* Return the request header values for the given header name,
* or <code>null</code> if none.
* <p>A single-value header will be exposed as an array with a single element.
* @since 3.0
* @see javax.servlet.http.HttpServletRequest#getHeaders(String)
*/
String[] getHeaderValues(String headerName);
/**
* Return a Iterator over request header names.
* @see javax.servlet.http.HttpServletRequest#getHeaderNames()
* @since 3.0
* @see javax.servlet.http.HttpServletRequest#getHeaderNames()
*/
Iterator<String> getHeaderNames();