Class SimpleControllerHandlerAdapter

  extended byorg.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
All Implemented Interfaces:

public class SimpleControllerHandlerAdapter
extends java.lang.Object
implements HandlerAdapter

Adapter to use the Controller workflow interface with the generic DispatcherServlet. Supports controllers that implement the LastModified interface.

This is an SPI class, not used directly by application code.

$Id:,v 1.7 2004/03/18 02:46:08 trisberg Exp $
Rod Johnson
See Also:
DispatcherServlet, Controller, LastModified

Constructor Summary
Method Summary
 long getLastModified(javax.servlet.http.HttpServletRequest request, java.lang.Object handler)
          Same contract as for HttpServlet.getLastModified.
 ModelAndView handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler)
          Use the given handler to handle this request.
 boolean supports(java.lang.Object handler)
          Given a handler instance, return whether or not this HandlerAdapter can support it.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public SimpleControllerHandlerAdapter()
Method Detail


public boolean supports(java.lang.Object handler)
Description copied from interface: HandlerAdapter
Given a handler instance, return whether or not this HandlerAdapter can support it. Usually HandlerAdapters will base the decision on the handler type. HandlerAdapters will normally support only one handler type.

A typical implementation:

return handler != null && MyHandler.class.isAssignableFrom(handler.getClass());

Specified by:
supports in interface HandlerAdapter
handler - handler object to check
whether or not this object can use the given handler


public ModelAndView handle(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response,
                           java.lang.Object handler)
                    throws java.lang.Exception
Description copied from interface: HandlerAdapter
Use the given handler to handle this request. The workflow that is required may vary widely.

Specified by:
handle in interface HandlerAdapter
request - current HTTP request
response - current HTTP response
handler - handler to use. This object must have previously been passed to the supports() method of this interface, which must have returned true. Implementations that generate output themselves (and return null from this method) may encounter IOExceptions.
ModelAndView object with the name of the view and the required model data, or null if the request has been handled directly
java.lang.Exception - in case of errors


public long getLastModified(javax.servlet.http.HttpServletRequest request,
                            java.lang.Object handler)
Description copied from interface: HandlerAdapter
Same contract as for HttpServlet.getLastModified. Can simply return -1 if there's no support in the handler class.

Specified by:
getLastModified in interface HandlerAdapter
request - current HTTP request
handler - handler to use
the lastModified value for the given handler
See Also:
HttpServlet.getLastModified(javax.servlet.http.HttpServletRequest), LastModified.getLastModified(javax.servlet.http.HttpServletRequest)

Copyright (C) 2003-2004 The Spring Framework Project.