Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
import org.springframework.web.method.support.ModelAndViewContainer;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.mvc.LastModified;
import org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver;
import org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
Expand Down Expand Up @@ -821,16 +822,21 @@ protected ModelAndView handleInternal(HttpServletRequest request,
}

/**
* This implementation always returns -1. An {@code @RequestMapping} method can
* calculate the lastModified value, call {@link WebRequest#checkNotModified(long)},
* This implementation delegates the call to bean,
* if it implements the {@link LastModified} interface or returns -1 by default.
* <p>An {@code @RequestMapping} method can calculate the lastModified value,
* call {@link WebRequest#checkNotModified(long)},
* and return {@code null} if the result of that call is {@code true}.
*/
@Override
protected long getLastModifiedInternal(HttpServletRequest request, HandlerMethod handlerMethod) {
Object bean = handlerMethod.getBean();
if (bean instanceof LastModified) {
return ((LastModified) bean).getLastModified(request);
}
return -1;
}


/**
* Return the {@link SessionAttributesHandler} instance for the given handler type
* (never {@code null}).
Expand Down