Interface LastModified
getLastModified
method.
Delegated to by a HandlerAdapter.getLastModified(jakarta.servlet.http.HttpServletRequest, java.lang.Object)
implementation. By default, any Controller or HttpRequestHandler within Spring's
default framework can implement this interface to enable last-modified checking.
Note: Alternative handler implementation approaches have different
last-modified handling styles. For example, Spring 2.5's annotated controller
approach (using @RequestMapping
) provides last-modified support
through the WebRequest.checkNotModified(long)
method, allowing for last-modified checking within the main handler method.
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlong
getLastModified
(HttpServletRequest request) Deprecated.Same contract as for HttpServlet'sgetLastModified
method.
-
Method Details
-
getLastModified
Deprecated.Same contract as for HttpServlet'sgetLastModified
method. Invoked before request processing.The return value will be sent to the HTTP client as Last-Modified header, and compared with If-Modified-Since headers that the client sends back. The content will only get regenerated if there has been a modification.
- Parameters:
request
- current HTTP request- Returns:
- the time the underlying resource was last modified, or -1 meaning that the content must always be regenerated
- See Also:
-
checkNotModified
methods inWebRequest
, or from an annotated controller method, returning aResponseEntity
with an "ETag" and/or "Last-Modified" headers set.