Package org.springframework.web.servlet.function

# Interface ServerResponse.HeadersBuilder.WriteFunction

Enclosing interface:
  ServerResponse.HeadersBuilder<B extends ServerResponse.HeadersBuilder<B>>

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface ServerResponse.HeadersBuilder.WriteFunction
Defines the contract for `ServerResponse.HeadersBuilder.build(WriteFunction)`.

Since:
  6.1

## Method Summary

Modifier and Type
Method
Description
`ModelAndView`
`write(HttpServletRequest servletRequest, HttpServletResponse servletResponse)`
Write to the given `servletResponse`, or return a `ModelAndView` to be rendered.

## Method Details

### write

@Nullable ModelAndView write(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception
Write to the given `servletResponse`, or return a `ModelAndView` to be rendered.

Parameters:
  `servletRequest` - the HTTP request
  `servletResponse` - the HTTP response to write to
Returns:
  a `ModelAndView` to render, or `null` if handled directly
Throws:
  `Exception` - in case of Servlet errors