/*
 * Copyright 2002-2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.web.servlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * MVC framework SPI interface, allowing parameterization of core MVC workflow.
 *
 * <p>Interface that must be implemented for each handler type to handle a request.
 * This interface is used to allow the {@link DispatcherServlet} to be indefinitely
 * extensible. The DispatcherServlet accesses all installed handlers through this
 * interface, meaning that it does not contain code specific to any handler type.
 *
 * <p>Note that a handler can be of type {@code Object}. This is to enable
 * handlers from other frameworks to be integrated with this framework without
 * custom coding, as well as to allow for annotation handler objects that do
 * not obey any specific Java interface.
 *
 * <p>This interface is not intended for application developers. It is available
 * to handlers who want to develop their own web workflow.
 *
 * <p>Note: HandlerAdaptger implementators may implement the
 * {@link org.springframework.core.Ordered} interface to be able to specify a
 * sorting order (and thus a priority) for getting applied by DispatcherServlet.
 * Non-Ordered instances get treated as lowest priority.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 * @see org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
 * @see org.springframework.web.servlet.handler.SimpleServletHandlerAdapter
 */
public interface HandlerAdapter {

	/**
	 * Given a handler instance, return whether or not this HandlerAdapter can
	 * support it. Typical HandlerAdapters will base the decision on the handler
	 * type. HandlerAdapters will usually only support one handler type each.
	 * <p>A typical implementation:
	 * <p>{@code
	 * return (handler instanceof MyHandler);
	 * }
	 * @param handler handler object to check
	 * @return whether or not this object can use the given handler
	 */
	boolean supports(Object handler);

	/**
	 * Use the given handler to handle this request.
	 * The workflow that is required may vary widely.
	 * @param request current HTTP request
	 * @param response current HTTP response
	 * @param handler handler to use. This object must have previously been passed
	 * to the {@code supports} method of this interface, which must have
	 * returned {@code true}.
	 * @throws Exception in case of errors
	 * @return ModelAndView object with the name of the view and the required
	 * model data, or {@code null} if the request has been handled directly
	 */
	ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception;

	/**
	 * Same contract as for HttpServlet's {@code getLastModified} method.
	 * Can simply return -1 if there's no support in the handler class.
	 * @param request current HTTP request
	 * @param handler handler to use
	 * @return the lastModified value for the given handler
	 * @see javax.servlet.http.HttpServlet#getLastModified
	 * @see org.springframework.web.servlet.mvc.LastModified#getLastModified
	 */
	long getLastModified(HttpServletRequest request, Object handler);

}

@@ -17,17 +17,17 @@
 2002-201
-2
+3
  the ori
@@ -775,26 +775,16 @@
 work SPI
- interface
 , allowi
@@ -806,16 +806,20 @@
 tion of 
+the 
 core MVC
@@ -1019,16 +1019,23 @@
 le. The 
+%7B@code 
 Dispatch
@@ -1043,16 +1043,17 @@
 rServlet
+%7D
  accesse
@@ -1088,16 +1088,16 @@
 ough
+%0A *
  this
-%0A *
  int
@@ -1381,16 +1381,23 @@
 notation
+-driven
  handler
@@ -1413,14 +1413,14 @@
 that
- do
 %0A *
+ do
  not
@@ -1611,16 +1611,23 @@
 %3Cp%3ENote:
+ %7B@code
  Handler
@@ -1635,11 +1635,11 @@
 dapt
-g
 er
+%7D
  imp
@@ -1644,18 +1644,16 @@
 mplement
-at
 ors may 
@@ -1669,18 +1669,18 @@
  the
-%0A *
  %7B@link
+%0A *
  org
@@ -1747,19 +1747,16 @@
 fy a
-%0A *
  sorting
  ord
@@ -1751,16 +1751,19 @@
  sorting
+%0A *
  order (
@@ -1806,16 +1806,27 @@
 lied by 
+the %7B@code 
 Dispatch
@@ -1834,16 +1834,17 @@
 rServlet
+%7D
 .%0A * Non
@@ -2199,16 +2199,23 @@
 ot this 
+%7B@code 
 HandlerA
@@ -2224,16 +2224,17 @@
 pter
+%7D%0A%09 *
  can
-%0A%09 *
  sup

Fix typos in HandlerAdapter