Coming Up for Air

GlassFish 3.1.2, REST Security, and the Jersey Client

Monday, Mar 12, 2012 |

GlassFish 3.1.2, REST Security, and the Jersey Client

Jason Lee 2012-03-12

I recently blogged about a change we made in GlassFish 3.1.2 with regard to REST security. Specifically, we added some CSRF protection (you can read the details here ). For those of you using the Jersey Client, updating your code to support this change is very simple:
import com.sun.jersey.api.client.filter.CsrfProtectionFilter;
// ...
Client client = new Client();
client.addFilter(new CsrfProtectionFilter());
// ...

On the client side, that's all you have to change. Jersey will take care of the details.

Hat tip to Dan Allen for suggesting this post. :)