Reputation: 137
I'm using Play Framework 2.3.2 (Java version)
I was wondering how I would go about adding multiple filters to the filters() override in Global.java? I have this to enable the CSRF Filter:
public class Global extends GlobalSettings {
@Override
public <T extends EssentialFilter> Class<T>[] filters() {
return new Class[]{CSRFFilter.class};
}
}
and I'd like to now also add the Gzip filter. What's the correct syntax to use to have both the CSRF filter and GZIP compression? It's described here: http://www.playframework.com/documentation/2.3.x/GzipEncoding but it doesn't say how to add that as a filter when one already exists.
Thanks in advance!
Upvotes: 3
Views: 989
Reputation: 12986
You can add them in the array like
return new Class[]{CSRFFilter.class, GzipFilter.class};
Unfortunately I didn't find any info about the order they are executed, but I guess they are executed in the order they are defined in the array.
Upvotes: 2