Top Description Methods
org.springframework.web.servlet.mvc

public Interface LastModified

Annotations
@Deprecated
Imports
jakarta.servlet.http.HttpServletRequest

Deprecated

as of 5.3.9 in favor of using the checkNotModified methods in org.springframework.web.context.request.WebRequest, or from an annotated controller method, returning a org.springframework.http.ResponseEntity with an "ETag" and/or "Last-Modified" headers set.

Supports last-modified HTTP requests to facilitate content caching. Same contract as for the Servlet API's getLastModified method.

Delegated to by a org.springframework.web.servlet.HandlerAdapter#getLastModified 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 org.springframework.web.context.request.WebRequest#checkNotModified method, allowing for last-modified checking within the main handler method.

Authors
Rod Johnson, Juergen Hoeller
See Also
jakarta.servlet.http.HttpServlet#getLastModified, Controller, SimpleControllerHandlerAdapter, org.springframework.web.HttpRequestHandler, HttpRequestHandlerAdapter

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

the time the underlying resource was last modified, or -1 meaning that the content must always be regenerated
getLastModified
(HttpServletRequest
current HTTP request
request
)

Same contract as for HttpServlet's getLastModified method.

Method Detail

getLastModifiedback to summary
public long getLastModified(HttpServletRequest request)

Same contract as for HttpServlet's getLastModified 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:HttpServletRequest

current HTTP request

Returns:long

the time the underlying resource was last modified, or -1 meaning that the content must always be regenerated

See Also
org.springframework.web.servlet.HandlerAdapter#getLastModified, jakarta.servlet.http.HttpServlet#getLastModified