com.sun.jersey.api.client.filter
Class CsrfProtectionFilter

java.lang.Object
  extended by com.sun.jersey.api.client.filter.ClientFilter
      extended by com.sun.jersey.api.client.filter.CsrfProtectionFilter
All Implemented Interfaces:
ClientHandler

public class CsrfProtectionFilter
extends ClientFilter

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 the CsrfProtectionFilter on the server side.

Author:
Martin Matula

Constructor Summary
CsrfProtectionFilter()
           
CsrfProtectionFilter(java.lang.String requestedBy)
          Initialized the filter with a desired value of the X-Requested-By header.
 
Method Summary
 ClientResponse handle(ClientRequest cr)
          Adds X-Requested-By header (if not present) to potentially state changing requests.
 
Methods inherited from class com.sun.jersey.api.client.filter.ClientFilter
getNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsrfProtectionFilter

public CsrfProtectionFilter()

CsrfProtectionFilter

public CsrfProtectionFilter(java.lang.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

handle

public ClientResponse handle(ClientRequest cr)
                      throws ClientHandlerException
Adds X-Requested-By header (if not present) to potentially state changing requests.

Specified by:
handle in interface ClientHandler
Specified by:
handle in class ClientFilter
Parameters:
cr - Client request to be processed.
Returns:
Response
Throws:
ClientHandlerException


Copyright © 2011 Oracle Corporation. All Rights Reserved.