Class CsrfProtectionFilter
- java.lang.Object
-
- org.glassfish.jersey.client.filter.CsrfProtectionFilter
-
- All Implemented Interfaces:
ClientRequestFilter
public class CsrfProtectionFilter extends Object implements ClientRequestFilter
Simple client-side filter that adds X-Requested-By headers to all state-changing request (i.e. request for methods other than GET, HEAD and OPTIONS). This is to satisfy the requirements of theorg.glassfish.jersey.server.filter.CsrfProtectionFilteron the server side.- Author:
- Martin Matula
-
-
Field Summary
Fields Modifier and Type Field Description static StringHEADER_NAMEName of the header this filter will attach to the request.
-
Constructor Summary
Constructors Constructor Description CsrfProtectionFilter()Creates a new instance of the filter with X-Requested-By header value set to empty string.CsrfProtectionFilter(String requestedBy)Initialized the filter with a desired value of the X-Requested-By header.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfilter(ClientRequestContext rc)Filter method called before a request has been dispatched to a client transport layer.
-
-
-
Field Detail
-
HEADER_NAME
public static final String HEADER_NAME
Name of the header this filter will attach to the request.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CsrfProtectionFilter
public CsrfProtectionFilter()
Creates a new instance of the filter with X-Requested-By header value set to empty string.
-
CsrfProtectionFilter
public CsrfProtectionFilter(String requestedBy)
Initialized the filter with a desired value of the X-Requested-By header.- Parameters:
requestedBy- Desired value of X-Requested-By header the filter will be adding for all potentially state changing requests.
-
-
Method Detail
-
filter
public void filter(ClientRequestContext rc) throws IOException
Description copied from interface:ClientRequestFilterFilter method called before a request has been dispatched to a client transport layer. Filters in the filter chain are ordered according to theirjakarta.annotation.Priorityclass-level annotation value.- Specified by:
filterin interfaceClientRequestFilter- Parameters:
rc- request context.- Throws:
IOException- if an I/O exception occurs.
-
-