1. /*
  2. * Copyright 2002-2004 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.springframework.web.servlet.mvc;
  17. import javax.servlet.http.HttpServletRequest;
  18. /**
  19. * Supports last-modified HTTP requests to facilitate content caching.
  20. * Same contract as for the Servlet API's getLastModified method.
  21. *
  22. * <p>Delegated to by SimpleControllerHandlerAdapter's getLastModified method.
  23. * Any controller within Spring's default MVC framework can implement this.
  24. *
  25. * @author Rod Johnson
  26. * @see SimpleControllerHandlerAdapter
  27. * @see javax.servlet.http.HttpServlet#getLastModified
  28. */
  29. public interface LastModified {
  30. /**
  31. * Same contract as for HttpServlet's getLastModified method.
  32. * Invoked <b>before</b> request processing.
  33. * <p>The return value will be sent to the HTTP client as Last-Modified header,
  34. * and compared with If-Modified-Since headers that the client sends back.
  35. * The content will only get regenerated if there has been a modification.
  36. * @param request current HTTP request
  37. * @return the time the underlying resource was last modified, or -1
  38. * meaning that the content must always be regenerated
  39. * @see org.springframework.web.servlet.HandlerAdapter#getLastModified
  40. * @see javax.servlet.http.HttpServlet#getLastModified
  41. */
  42. long getLastModified(HttpServletRequest request);
  43. }