Package org.springframework.http.server.reactive

# Class HttpHeadResponseDecorator

java.lang.Object
org.springframework.http.server.reactive.ServerHttpResponseDecorator
org.springframework.http.server.reactive.HttpHeadResponseDecorator

All Implemented Interfaces:
  `HttpMessage`, `ReactiveHttpOutputMessage`, `ServerHttpResponse`

public class HttpHeadResponseDecorator extends ServerHttpResponseDecorator
`ServerHttpResponse` decorator for HTTP HEAD requests.

Since:
  5.0
Author:
  Rossen Stoyanchev

## Constructor Summary

Constructors
Constructor
Description
`HttpHeadResponseDecorator(ServerHttpResponse delegate)`

## Method Summary

Modifier and Type
Method
Description
`final reactor.core.publisher.Mono<Void>`
`writeAndFlushWith(Publisher<? extends Publisher<? extends org.springframework.core.io.buffer.DataBuffer>> body)`
Invoke `ServerHttpResponseDecorator.setComplete()` without writing.
`final reactor.core.publisher.Mono<Void>`
`writeWith(Publisher<? extends org.springframework.core.io.buffer.DataBuffer> body)`
Consume and release the body without writing.

### Methods inherited from class org.springframework.http.server.reactive.ServerHttpResponseDecorator

`addCookie, beforeCommit, bufferFactory, getCookies, getDelegate, getHeaders, getNativeResponse, getRawStatusCode, getStatusCode, isCommitted, setComplete, setRawStatusCode, setStatusCode, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### HttpHeadResponseDecorator

public HttpHeadResponseDecorator(ServerHttpResponse delegate)

## Method Details

### writeWith

public final reactor.core.publisher.Mono<Void> writeWith(Publisher<? extends org.springframework.core.io.buffer.DataBuffer> body)
Consume and release the body without writing.

If the headers contain neither Content-Length nor Transfer-Encoding, and the body is a `Mono`, count the bytes and set Content-Length.

Specified by:
  `writeWith` in interface `ReactiveHttpOutputMessage`
Overrides:
  `writeWith` in class `ServerHttpResponseDecorator`
Parameters:
  `body` - the body content publisher
Returns:
  a `Mono` that indicates completion or error

### writeAndFlushWith

public final reactor.core.publisher.Mono<Void> writeAndFlushWith(Publisher<? extends Publisher<? extends org.springframework.core.io.buffer.DataBuffer>> body)
Invoke `ServerHttpResponseDecorator.setComplete()` without writing.

RFC 7302 allows HTTP HEAD response without content-length and it's not something that can be computed on a streaming response.

Specified by:
  `writeAndFlushWith` in interface `ReactiveHttpOutputMessage`
Overrides:
  `writeAndFlushWith` in class `ServerHttpResponseDecorator`
Parameters:
  `body` - the body content publisher
Returns:
  a `Mono` that indicates completion or error