Class XXssProtectionHeaderWriter
java.lang.Object
org.springframework.security.web.header.writers.XXssProtectionHeaderWriter
- All Implemented Interfaces:
HeaderWriter
Renders the X-XSS-Protection header.
- Since:
- 3.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setBlock
(boolean block) If false, will not specify the mode as blocked.void
setEnabled
(boolean enabled) If true, will contain a value of 1.toString()
void
writeHeaders
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Create aHeader
instance.
-
Constructor Details
-
XXssProtectionHeaderWriter
public XXssProtectionHeaderWriter()Create a new instance
-
-
Method Details
-
writeHeaders
public void writeHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Description copied from interface:HeaderWriter
Create aHeader
instance.- Specified by:
writeHeaders
in interfaceHeaderWriter
- Parameters:
request
- the requestresponse
- the response
-
setEnabled
public void setEnabled(boolean enabled) If true, will contain a value of 1. For example:X-XSS-Protection: 1
or ifsetBlock(boolean)
is trueX-XSS-Protection: 1; mode=block
If false, will explicitly disable specify that X-XSS-Protection is disabled. For example:X-XSS-Protection: 0
- Parameters:
enabled
- the new value
-
setBlock
public void setBlock(boolean block) If false, will not specify the mode as blocked. In this instance, any content will be attempted to be fixed. If true, the content will be replaced with "#".- Parameters:
block
- the new value
-
toString
-