类 HandlerFunctionAdapter
- java.lang.Object
- org.springframework.web.servlet.function.support.HandlerFunctionAdapter
- 所有已实现的接口:
Ordered,HandlerAdapter
public class HandlerFunctionAdapter extends Object implements HandlerAdapter, Ordered
HandlerAdapterimplementation that supportsHandlerFunctions.- 从以下版本开始:
- 5.2
- 作者:
- Arjen Poutsma
字段概要
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
构造器概要
构造器 构造器 说明 HandlerFunctionAdapter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 longgetLastModified(HttpServletRequest request, Object handler)Same contract as for HttpServlet'sgetLastModifiedmethod.intgetOrder()Get the order value of this object.ModelAndViewhandle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Object handler)Use the given handler to handle this request.voidsetOrder(int order)Specify the order value for this HandlerAdapter bean.booleansupports(Object handler)Given a handler instance, return whether or not thisHandlerAdaptercan support it.
构造器详细资料
HandlerFunctionAdapter
public HandlerFunctionAdapter()
方法详细资料
setOrder
public void setOrder(int order)
Specify the order value for this HandlerAdapter bean.The default value is
Ordered.LOWEST_PRECEDENCE, meaning non-ordered.- 另请参阅:
Ordered.getOrder()
getOrder
public int getOrder()
从接口复制的说明:OrderedGet the order value of this object.Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet
load-on-startupvalues).Same order values will result in arbitrary sort positions for the affected objects.
- 指定者:
getOrder在接口中Ordered- 返回:
- the order value
- 另请参阅:
Ordered.HIGHEST_PRECEDENCE,Ordered.LOWEST_PRECEDENCE
supports
public boolean supports(Object handler)
从接口复制的说明:HandlerAdapterGiven a handler instance, return whether or not thisHandlerAdaptercan 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);- 指定者:
supports在接口中HandlerAdapter- 参数:
handler- the handler object to check- 返回:
- whether or not this object can use the given handler
handle
@Nullable public ModelAndView handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Object handler) throws Exception
从接口复制的说明:HandlerAdapterUse the given handler to handle this request. The workflow that is required may vary widely.- 指定者:
handle在接口中HandlerAdapter- 参数:
servletRequest- current HTTP requestservletResponse- current HTTP responsehandler- the handler to use. This object must have previously been passed to thesupportsmethod of this interface, which must have returnedtrue.- 返回:
- a ModelAndView object with the name of the view and the required model data, or
nullif the request has been handled directly - 抛出:
Exception- in case of errors
getLastModified
public long getLastModified(HttpServletRequest request, Object handler)
从接口复制的说明:HandlerAdapterSame contract as for HttpServlet'sgetLastModifiedmethod. Can simply return -1 if there's no support in the handler class.- 指定者:
getLastModified在接口中HandlerAdapter- 参数:
request- current HTTP requesthandler- the handler to use- 返回:
- the lastModified value for the given handler
- 另请参阅:
HttpServlet.getLastModified(javax.servlet.http.HttpServletRequest),LastModified.getLastModified(javax.servlet.http.HttpServletRequest)