Package org.springframework.security.web.server.header

# Class ServerWebExchangeDelegatingServerHttpHeadersWriter

java.lang.Object
org.springframework.security.web.server.header.ServerWebExchangeDelegatingServerHttpHeadersWriter

All Implemented Interfaces:
  `ServerHttpHeadersWriter`

public final class ServerWebExchangeDelegatingServerHttpHeadersWriter extends Object implements ServerHttpHeadersWriter
Delegates to a provided `ServerHttpHeadersWriter` if `ServerWebExchangeMatcher.matches(ServerWebExchange)` returns a match.

Since:
  5.8

## Constructor Summary

Constructors
Constructor
Description
`ServerWebExchangeDelegatingServerHttpHeadersWriter(ServerWebExchangeMatcherEntry<ServerHttpHeadersWriter> headersWriter)`
Creates a new instance
`ServerWebExchangeDelegatingServerHttpHeadersWriter(ServerWebExchangeMatcher webExchangeMatcher, ServerHttpHeadersWriter delegateHeadersWriter)`
Creates a new instance

## Method Summary

Modifier and Type
Method
Description
`reactor.core.publisher.Mono<Void>`
`writeHttpHeaders(org.springframework.web.server.ServerWebExchange exchange)`
Write the headers to the response.

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

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

## Constructor Details

### ServerWebExchangeDelegatingServerHttpHeadersWriter

public ServerWebExchangeDelegatingServerHttpHeadersWriter(ServerWebExchangeMatcherEntry<ServerHttpHeadersWriter> headersWriter)
Creates a new instance

Parameters:
  `headersWriter` - the `ServerWebExchangeMatcherEntry` holding a `ServerWebExchangeMatcher` and the `ServerHttpHeadersWriter` to invoke if the matcher returns a match.

### ServerWebExchangeDelegatingServerHttpHeadersWriter

public ServerWebExchangeDelegatingServerHttpHeadersWriter(ServerWebExchangeMatcher webExchangeMatcher, ServerHttpHeadersWriter delegateHeadersWriter)
Creates a new instance

Parameters:
  `webExchangeMatcher` - the `ServerWebExchangeMatcher` to use. If it returns a match, the delegateHeadersWriter is invoked.
  `delegateHeadersWriter` - the `ServerHttpHeadersWriter` to invoke if the `ServerWebExchangeMatcher` returns a match.

## Method Details

### writeHttpHeaders

public reactor.core.publisher.Mono<Void> writeHttpHeaders(org.springframework.web.server.ServerWebExchange exchange)
Description copied from interface: `ServerHttpHeadersWriter`
Write the headers to the response.

Specified by:
  `writeHttpHeaders` in interface `ServerHttpHeadersWriter`
Returns:
  A Mono which is returned to the `Supplier` of the `ReactiveHttpOutputMessage.beforeCommit(Supplier)`.