The Spring Framework

org.springframework.web.servlet.mvc.throwaway
Class ThrowawayControllerHandlerAdapter

java.lang.Object
  extended by org.springframework.web.servlet.mvc.throwaway.ThrowawayControllerHandlerAdapter
All Implemented Interfaces:
HandlerAdapter

Deprecated. as of Spring 2.5, in favor of annotation-based controllers. To be removed in Spring 3.0.

public class ThrowawayControllerHandlerAdapter
extends Object
implements HandlerAdapter

Adapter to use the ThrowawayController workflow interface with the generic DispatcherServlet. Does not support last-modified checks.

This is an SPI class, not used directly by application code. It can be explicitly configured in a DispatcherServlet context, to use a customized version instead of the default ThrowawayControllerHandlerAdapter.

Since:
08.12.2003
Author:
Juergen Hoeller

Field Summary
static String DEFAULT_COMMAND_NAME
          Deprecated.  
 
Constructor Summary
ThrowawayControllerHandlerAdapter()
          Deprecated.  
 
Method Summary
protected  ServletRequestDataBinder createBinder(HttpServletRequest request, ThrowawayController command)
          Deprecated. Create a new binder instance for the given command and request.
 String getCommandName()
          Deprecated. Return the name of the command in the model.
 long getLastModified(HttpServletRequest request, Object handler)
          Deprecated. This implementation always returns -1, as last-modified checks are not supported.
 ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler)
          Deprecated. This implementation binds request parameters to the ThrowawayController instance and then calls execute on it.
protected  void initBinder(HttpServletRequest request, ServletRequestDataBinder binder)
          Deprecated. Initialize the given binder instance, for example with custom editors.
 void setCommandName(String commandName)
          Deprecated. Set the name of the command in the model.
 boolean supports(Object handler)
          Deprecated. 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
 

Field Detail

DEFAULT_COMMAND_NAME

public static final String DEFAULT_COMMAND_NAME
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

ThrowawayControllerHandlerAdapter

public ThrowawayControllerHandlerAdapter()
Deprecated. 
Method Detail

setCommandName

public final void setCommandName(String commandName)
Deprecated. 
Set the name of the command in the model. The command object will be included in the model under this name.


getCommandName

public final String getCommandName()
Deprecated. 
Return the name of the command in the model.


supports

public boolean supports(Object handler)
Deprecated. 
Description copied from 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.

A typical implementation:

return (handler instanceof MyHandler);

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

handle

public ModelAndView handle(HttpServletRequest request,
                           HttpServletResponse response,
                           Object handler)
                    throws Exception
Deprecated. 
This implementation binds request parameters to the ThrowawayController instance and then calls execute on it.

Specified by:
handle in interface HandlerAdapter
Parameters:
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.
Returns:
ModelAndView object with the name of the view and the required model data, or null if the request has been handled directly
Throws:
Exception - in case of errors
See Also:
createBinder(javax.servlet.http.HttpServletRequest, org.springframework.web.servlet.mvc.throwaway.ThrowawayController), ThrowawayController.execute()

createBinder

protected ServletRequestDataBinder createBinder(HttpServletRequest request,
                                                ThrowawayController command)
                                         throws Exception
Deprecated. 
Create a new binder instance for the given command and request.

Called by bindAndValidate. Can be overridden to plug in custom ServletRequestDataBinder subclasses.

Default implementation creates a standard ServletRequestDataBinder, sets the specified MessageCodesResolver (if any), and invokes initBinder. Note that initBinder will not be invoked if you override this method!

Parameters:
request - current HTTP request
command - the command to bind onto
Returns:
the new binder instance
Throws:
Exception - in case of invalid state or arguments
See Also:
initBinder(javax.servlet.http.HttpServletRequest, org.springframework.web.bind.ServletRequestDataBinder), getCommandName()

initBinder

protected void initBinder(HttpServletRequest request,
                          ServletRequestDataBinder binder)
                   throws Exception
Deprecated. 
Initialize the given binder instance, for example with custom editors. Called by createBinder.

This method allows you to register custom editors for certain fields of your command class. For instance, you will be able to transform Date objects into a String pattern and back, in order to allow your JavaBeans to have Date properties and still be able to set and display them in an HTML interface.

Default implementation is empty.

Parameters:
request - current HTTP request
binder - new binder instance
Throws:
Exception - in case of invalid state or arguments
See Also:
createBinder(javax.servlet.http.HttpServletRequest, org.springframework.web.servlet.mvc.throwaway.ThrowawayController), DataBinder.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor), CustomDateEditor

getLastModified

public long getLastModified(HttpServletRequest request,
                            Object handler)
Deprecated. 
This implementation always returns -1, as last-modified checks are not supported.

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

The Spring Framework

Copyright © 2002-2008 The Spring Framework.