Package org.springframework.security.web.header.writers

# Class DelegatingRequestMatcherHeaderWriter

java.lang.Object
org.springframework.security.web.header.writers.DelegatingRequestMatcherHeaderWriter

All Implemented Interfaces:
  `HeaderWriter`

public final class DelegatingRequestMatcherHeaderWriter extends Object implements HeaderWriter
Delegates to the provided `HeaderWriter` when `RequestMatcher.matches(HttpServletRequest)` returns true.

Since:
  3.2

## Constructor Summary

Constructors
Constructor
Description
`DelegatingRequestMatcherHeaderWriter(RequestMatcher requestMatcher, HeaderWriter delegateHeaderWriter)`
Creates a new instance

## Method Summary

Modifier and Type
Method
Description
`String`
`toString()`
`void`
`writeHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)`
Create a `Header` instance.

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

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

## Constructor Details

### DelegatingRequestMatcherHeaderWriter

public DelegatingRequestMatcherHeaderWriter(RequestMatcher requestMatcher, HeaderWriter delegateHeaderWriter)
Creates a new instance

Parameters:
  `requestMatcher` - the `RequestMatcher` to use. If returns true, the delegateHeaderWriter will be invoked.
  `delegateHeaderWriter` - the `HeaderWriter` to invoke if the `RequestMatcher` returns true.

## Method Details

### writeHeaders

public void writeHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
Description copied from interface: `HeaderWriter`
Create a `Header` instance.

Specified by:
  `writeHeaders` in interface `HeaderWriter`
Parameters:
  `request` - the request
  `response` - the response

### toString

public String toString()

Overrides:
  `toString` in class `Object`