1 /* 2 * Copyright 2002-2006 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 17 package org.springframework.web.servlet.mvc; 18 19 import javax.servlet.http.HttpServletRequest; 20 21 /** 22 * Supports last-modified HTTP requests to facilitate content caching. 23 * Same contract as for the Servlet API's <code>getLastModified</code> method. 24 * 25 * <p>Delegated to by a HandlerAdapter's <code>getLastModified</code> implementation. 26 * By default, any Controller or HttpRequestHandler within Spring's default framework 27 * can implement this interface to enable last-modified checking. 28 * 29 * @author Rod Johnson 30 * @author Juergen Hoeller 31 * @see javax.servlet.http.HttpServlet#getLastModified 32 * @see Controller 33 * @see SimpleControllerHandlerAdapter 34 * @see org.springframework.web.HttpRequestHandler 35 * @see HttpRequestHandlerAdapter 36 */ 37 public interface LastModified { 38 39 /** 40 * Same contract as for HttpServlet's <code>getLastModified</code> method. 41 * Invoked <b>before</b> request processing. 42 * <p>The return value will be sent to the HTTP client as Last-Modified header, 43 * and compared with If-Modified-Since headers that the client sends back. 44 * The content will only get regenerated if there has been a modification. 45 * @param request current HTTP request 46 * @return the time the underlying resource was last modified, or -1 47 * meaning that the content must always be regenerated 48 * @see org.springframework.web.servlet.HandlerAdapter#getLastModified 49 * @see javax.servlet.http.HttpServlet#getLastModified 50 */ 51 long getLastModified(HttpServletRequest request); 52 53 } 54