Top Description Inners Fields Constructors Methods
org.springframework.web.servlet.function.support

public Class HandlerFunctionAdapter

extends Object
implements HandlerAdapter, Ordered
Class Inheritance
All Implemented Interfaces
org.springframework.core.Ordered, org.springframework.web.servlet.HandlerAdapter
Imports
java.util.List, jakarta.servlet.ServletException, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.apache.commons.logging.Log, .LogFactory, org.springframework.core.Ordered, org.springframework.core.log.LogFormatUtils, org.springframework.http.converter.HttpMessageConverter, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.context.request.async.AsyncWebRequest, .WebAsyncManager, .WebAsyncUtils, org.springframework.web.servlet.HandlerAdapter, .ModelAndView, org.springframework.web.servlet.function.HandlerFunction, .RouterFunctions, .ServerRequest, .ServerResponse

HandlerAdapter implementation that supports HandlerFunctions.
Author
Arjen Poutsma
Since
5.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private Long
private static final Log
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long
getLastModified(HttpServletRequest
current HTTP request
request
,
Object
the handler to use
handler
)

Implements org.springframework.web.servlet.HandlerAdapter.getLastModified.

Same contract as for HttpServlet's getLastModified method.

public int
getOrder()

Implements org.springframework.core.Ordered.getOrder.

Get the order value of this object.

private ServerRequest
private WebAsyncManager
public ModelAndView
handle(HttpServletRequest
current HTTP request
servletRequest
,
HttpServletResponse
current HTTP response
servletResponse
,
Object
the handler to use. This object must have previously been passed to the supports method of this interface, which must have returned true.
handler
)

Implements org.springframework.web.servlet.HandlerAdapter.handle.

Use the given handler to handle this request.

private ServerResponse
public void
setAsyncRequestTimeout(long
the timeout value in milliseconds
timeout
)

Specify the amount of time, in milliseconds, before concurrent handling should time out.

public void
setOrder(int order)

Specify the order value for this HandlerAdapter bean.

public boolean
supports(Object
the handler object to check
handler
)

Implements org.springframework.web.servlet.HandlerAdapter.supports.

Given a handler instance, return whether this HandlerAdapter can support it.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

asyncRequestTimeoutback to summary
private Long asyncRequestTimeout
Annotations
@Nullable
loggerback to summary
private static final Log logger
orderback to summary
private int order

Constructor Detail

HandlerFunctionAdapterback to summary
public HandlerFunctionAdapter()

Method Detail

getLastModifiedback to summary
public long getLastModified(HttpServletRequest request, Object handler)

Implements org.springframework.web.servlet.HandlerAdapter.getLastModified.

Doc from org.springframework.web.servlet.HandlerAdapter.getLastModified.

Same contract as for HttpServlet's getLastModified method. Can simply return -1 if there's no support in the handler class.

Parameters
request:HttpServletRequest

current HTTP request

handler:Object

the handler to use

Returns:long

the lastModified value for the given handler

Annotations
@Override
@SuppressWarnings:deprecation
getOrderback to summary
public int getOrder()

Implements org.springframework.core.Ordered.getOrder.

Doc from org.springframework.core.Ordered.getOrder.

Get 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-startup values).

Same order values will result in arbitrary sort positions for the affected objects.

Returns:int

the order value

Annotations
@Override
getServerRequestback to summary
private ServerRequest getServerRequest(HttpServletRequest servletRequest)
getWebAsyncManagerback to summary
private WebAsyncManager getWebAsyncManager(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
handleback to summary
public ModelAndView handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Object handler) throws Exception

Implements org.springframework.web.servlet.HandlerAdapter.handle.

Doc from org.springframework.web.servlet.HandlerAdapter.handle.

Use the given handler to handle this request. The workflow that is required may vary widely.

Parameters
servletRequest:HttpServletRequest

current HTTP request

servletResponse:HttpServletResponse

current HTTP response

handler:Object

the handler to use. This object must have previously been passed to the supports method of this interface, which must have returned true.

Returns:ModelAndView

a ModelAndView object with the name of the view and the required model data, or null if the request has been handled directly

Annotations
@Nullable
@Override
Exceptions
Exception:
in case of errors
handleAsyncback to summary
private ServerResponse handleAsync(WebAsyncManager asyncManager) throws Exception
Annotations
@Nullable
setAsyncRequestTimeoutback to summary
public void setAsyncRequestTimeout(long timeout)

Specify the amount of time, in milliseconds, before concurrent handling should time out. In Servlet 3, the timeout begins after the main request processing thread has exited and ends when the request is dispatched again for further processing of the concurrently produced result.

If this value is not set, the default timeout of the underlying implementation is used.

A value of 0 or less indicates that the asynchronous operation will never time out.

Parameters
timeout:long

the timeout value in milliseconds

setOrderback to summary
public void setOrder(int order)

Specify the order value for this HandlerAdapter bean.

The default value is Ordered.LOWEST_PRECEDENCE, meaning non-ordered.

See Also
org.springframework.core.Ordered#getOrder()
supportsback to summary
public boolean supports(Object handler)

Implements org.springframework.web.servlet.HandlerAdapter.supports.

Doc from org.springframework.web.servlet.HandlerAdapter.supports.

Given a handler instance, return whether 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);

Parameters
handler:Object

the handler object to check

Returns:boolean

whether this object can use the given handler

Annotations
@Override
org.springframework.web.servlet.function.support back to summary

private Class HandlerFunctionAdapter.ServerRequestContext

extends Object
implements Context
Class Inheritance
  • java.lang.Object
  • org.springframework.web.servlet.function.support.HandlerFunctionAdapter.ServerRequestContext
All Implemented Interfaces
org.springframework.web.servlet.function.ServerResponse.Context

Field Summary

Modifier and TypeField and Description
private final ServerRequest

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public List<HttpMessageConverter<?>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

serverRequestback to summary
private final ServerRequest serverRequest

Constructor Detail

ServerRequestContextback to summary
public ServerRequestContext(ServerRequest serverRequest)

Method Detail

messageConvertersback to summary
public List<HttpMessageConverter<?>> messageConverters()

Implements org.springframework.web.servlet.function.ServerResponse.Context.messageConverters.

Doc from org.springframework.web.servlet.function.ServerResponse.Context.messageConverters.

Return the HttpMessageConverters to be used for response body conversion.

Returns:List<HttpMessageConverter<?>>

the list of message writers

Annotations
@Override