接口 HandlerAdapter
- 所有已知实现类:
AbstractHandlerAdapter,AbstractHandlerMethodAdapter,HandlerAdapters,HandlerFunctionAdapter,InterceptableHandlerAdapterDecorator,RequestMappingHandlerAdapter,ServletHandlerAdapter
Interface that must be implemented for each handler type to handle a request.
This interface is used to allow the
DispatcherHandler to be
indefinitely extensible. The DispatcherHandler accesses all installed
handlers through this interface, meaning that it does not contain code
specific to any handler type.
Note that a handler can be of type 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-driven handler objects that do not
obey any specific Java interface.
This interface is not intended for application developers. It is available to handlers who want to develop their own web workflow.
Note: HandlerAdapter implementors may implement the
Ordered interface to be able to specify
a sorting order (and thus a priority) for getting applied by the
DispatcherHandler. Non-Ordered instances get treated as lowest
priority.
Note: This framework allows use
HandlerAdapterCapable
to specific a HandlerAdapter at startup time
- 从以下版本开始:
- 2019-12-08 20:23
- 作者:
- Harry Yang
- 另请参阅:
-
字段概要
字段 -
方法概要
修饰符和类型方法说明static HandlerAdapterfind(cn.taketoday.context.ApplicationContext context) static HandlerAdapterfind(cn.taketoday.context.ApplicationContext context, boolean detectAllHandlerAdapters) handle(RequestContext context, Object handler) Use the given handler to handle this request.static HandlerAdapterof(List<HandlerAdapter> handlerAdapters) booleanGiven a handler instance, return whether support or not thisRequestHandlerAdaptercan support it.
-
字段详细资料
-
HANDLER_ADAPTER_BEAN_NAME
Well-known name for the HandlerAdapter object in the bean factory for this namespace. Only used when "detectAllHandlerAdapters" is turned off. -
NONE_RETURN_VALUE
This value indicates that the handler did not return a value, or the result has been processed
-
-
方法详细资料
-
supports
Given a handler instance, return whether support or not thisRequestHandlerAdaptercan support it. Typical RequestHandlerAdapters will base the decision on the handler type. RequestHandlerAdapters will usually only support one handler type each.A typical implementation:
return (handler instanceof MyHandler);- 参数:
handler- handler object to check- 返回:
- whether support or not this object can use the given handler
-
handle
Use the given handler to handle this request. The workflow that is required may vary widely.this result will handle by
ReturnValueHandler- 参数:
context- current HTTP request contexthandler- handler to use. This object must have previously been passed to thesupportsmethod of this interface, which must have returnedtrue.- 返回:
- an object with the name of the view and the required model data, or
nullif the request has been handled directly - 抛出:
Throwable- in case of errors- 另请参阅:
-
of
-
find
-
find
static HandlerAdapter find(cn.taketoday.context.ApplicationContext context, boolean detectAllHandlerAdapters)
-