public interface HttpFiltersComponents extends AllowedHostsComponents, CORSComponents, CSRFComponents, GzipFilterComponents, RedirectHttpsComponents, SecurityHeadersComponents, HttpComponents
Usage:
public class MyComponents extends BuiltInComponentsFromContext implements play.filters.components.HttpFiltersComponents { public MyComponents(ApplicationLoader.Context context) { super(context); } // required methods implementation }
NoHttpFiltersComponents
Modifier and Type | Method and Description |
---|---|
default java.util.List<EssentialFilter> |
httpFilters()
List of filters, typically provided by mixing in play.filters.HttpFiltersComponents or
play.api.NoHttpFiltersComponents.
|
allowedHostsConfig, allowedHostsFilter
corsConfig, corsFilter, corsPathPrefixes
addCSRFTokenAction, csrfAddToken, csrfCheck, csrfConfig, csrfErrorHandler, csrfFilter, csrfTokenProvider, requireCSRFCheckAction
clock, cookieSigner, csrfTokenSigner
httpErrorHandler, javaContextComponents, scalaHttpErrorHandler
gzipFilter, gzipFilterConfig
actorSystem, executionContext, materializer
environment, redirectHttpsConfiguration, redirectHttpsFilter
securityHeadersConfig, securityHeadersFilter
config, configuration
actionCreator, httpRequestHandler, javaHandlerComponents
httpConfiguration, sessionConfiguration
default java.util.List<EssentialFilter> httpFilters()
HttpComponents
In most cases you will want to mixin HttpFiltersComponents and append your own filters:
public class MyComponents extends BuiltInComponentsFromContext implements HttpFiltersComponents { public MyComponents(ApplicationLoader.Context context) { super(context); } public List<EssentialFilter> httpFilters() { List<EssentialFilter> filters = HttpFiltersComponents.super.httpFilters(); filters.add(loggingFilter); return filters; } // other required methods }If you want to filter elements out of the list, you can do the following:
class MyComponents extends BuiltInComponentsFromContext implements HttpFiltersComponents { public MyComponents(ApplicationLoader.Context context) { super(context); } public List<EssentialFilter> httpFilters() { return httpFilters().stream() // accept only filters that are not CSRFFilter .filter(f -> !f.getClass().equals(CSRFFilter.class)) .collect(Collectors.toList()); } // other required methods }
httpFilters
in interface HttpComponents
EssentialFilter