Class ReferrerPolicyHeaderWriter
java.lang.Object
org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter
- All Implemented Interfaces:
 HeaderWriter
Provides support for Referrer Policy.
The list of policies defined can be found at Referrer Policies.
 This implementation of HeaderWriter writes the following header:
 
- Referrer-Policy
 
 By default, the Referrer-Policy header is not included in the response. Policy
 no-referrer is used by default if no ReferrerPolicyHeaderWriter.ReferrerPolicy is set.
 
- Since:
 - 4.2
 
- 
Nested Class Summary
Nested Classes - 
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.Creates a new instance. - 
Method Summary
Modifier and TypeMethodDescriptionvoidSets the policy to be used in the response header.voidwriteHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Create aHeaderinstance. 
- 
Constructor Details
- 
ReferrerPolicyHeaderWriter
public ReferrerPolicyHeaderWriter()Creates a new instance. Default value: no-referrer. - 
ReferrerPolicyHeaderWriter
Creates a new instance.- Parameters:
 policy- a referrer policy- Throws:
 IllegalArgumentException- if policy is null
 
 - 
 - 
Method Details
- 
setPolicy
Sets the policy to be used in the response header.- Parameters:
 policy- a referrer policy- Throws:
 IllegalArgumentException- if policy is null
 - 
writeHeaders
public void writeHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Description copied from interface:HeaderWriterCreate aHeaderinstance.- Specified by:
 writeHeadersin interfaceHeaderWriter- Parameters:
 request- the requestresponse- the response- See Also:
 
 
 -