public class ReferrerPolicyHeaderWriter extends Object implements 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:
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.
Modifier and Type | Class and Description |
---|---|
static class |
ReferrerPolicyHeaderWriter.ReferrerPolicy |
Constructor and Description |
---|
ReferrerPolicyHeaderWriter()
Creates a new instance.
|
ReferrerPolicyHeaderWriter(ReferrerPolicyHeaderWriter.ReferrerPolicy policy)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
setPolicy(ReferrerPolicyHeaderWriter.ReferrerPolicy policy)
Sets the policy to be used in the response header.
|
void |
writeHeaders(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Create a
Header instance. |
public ReferrerPolicyHeaderWriter()
public ReferrerPolicyHeaderWriter(ReferrerPolicyHeaderWriter.ReferrerPolicy policy)
policy
- a referrer policyIllegalArgumentException
- if policy is nullpublic void setPolicy(ReferrerPolicyHeaderWriter.ReferrerPolicy policy)
policy
- a referrer policyIllegalArgumentException
- if policy is nullpublic void writeHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
HeaderWriter
Header
instance.writeHeaders
in interface HeaderWriter
request
- the requestresponse
- the responseHeaderWriter.writeHeaders(HttpServletRequest, HttpServletResponse)