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

# Class StaticHeadersWriter

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

All Implemented Interfaces:
  `HeaderWriter`

Direct Known Subclasses:
  `XContentTypeOptionsHeaderWriter`

public class StaticHeadersWriter extends Object implements HeaderWriter
`HeaderWriter` implementation which writes the same `Header` instance.

Since:
  3.2

## Constructor Summary

Constructors
Constructor
Description
`StaticHeadersWriter(String headerName, String... headerValues)`
Creates a new instance with a single header
`StaticHeadersWriter(List<Header> headers)`
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

### StaticHeadersWriter

public StaticHeadersWriter(List<Header> headers)
Creates a new instance

Parameters:
  `headers` - the `Header` instances to use

### StaticHeadersWriter

public StaticHeadersWriter(String headerName, String... headerValues)
Creates a new instance with a single header

Parameters:
  `headerName` - the name of the header
  `headerValues` - the values for the header

## 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`