Play Framework Multiple Filters in Global.java

I am using Play Framework 2.3.2 (Java version)

I was wondering how I would like to add multiple filters for filter () override in Global.java? I have this to enable CSRF filter:

public class Global extends GlobalSettings {
    @Override
    public <T extends EssentialFilter> Class<T>[] filters() {
        return new Class[]{CSRFFilter.class};
    }
}

      

and now I would like to add a Gzip filter. What is the correct syntax to use both CSRF filter and GZIP compression? It is documented here: http://www.playframework.com/documentation/2.3.x/GzipEncoding , but it doesn't tell you how to add this as a filter when it already exists.

Thanks in advance!

+3


source to share


1 answer


You can add them to an array like

return new Class[]{CSRFFilter.class, GzipFilter.class};

      



Unfortunately, I have not found any information about the order they are executed in, but I am assuming they are executed in the order they are defined in the array.

+2


source







All Articles