Package play.filters.components
Interface HttpFiltersComponents
- All Superinterfaces:
AllowedHostsComponents,ConfigurationComponents,CORSComponents,CryptoComponents,CSPComponents,CSRFComponents,GzipFilterComponents,HttpComponents,HttpConfigurationComponents,HttpErrorHandlerComponents,IPFilterComponents,PekkoComponents,RedirectHttpsComponents,SecurityHeadersComponents
public interface HttpFiltersComponents
extends AllowedHostsComponents, CORSComponents, CSPComponents, CSRFComponents, GzipFilterComponents, RedirectHttpsComponents, SecurityHeadersComponents, IPFilterComponents, HttpComponents
A compile time default filters components.
Usage:
public class MyComponents extends BuiltInComponentsFromContext
implements play.filters.components.HttpFiltersComponents {
public MyComponents(ApplicationLoader.Context context) {
super(context);
}
// required methods implementation
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault List<EssentialFilter>List of filters, typically provided by mixing in play.filters.HttpFiltersComponents or play.api.NoHttpFiltersComponents.Methods inherited from interface play.filters.components.AllowedHostsComponents
allowedHostsConfig, allowedHostsFilterMethods inherited from interface play.components.ConfigurationComponents
config, configurationMethods inherited from interface play.filters.components.CORSComponents
corsConfig, corsFilter, corsPathPrefixesMethods inherited from interface play.components.CryptoComponents
clock, cookieSigner, csrfTokenSignerMethods inherited from interface play.filters.components.CSPComponents
cspAction, cspConfig, cspFilter, cspProcessor, cspResultProcessorMethods inherited from interface play.filters.components.CSRFComponents
addCSRFTokenAction, csrfAddToken, csrfCheck, csrfConfig, csrfErrorHandler, csrfFilter, csrfTokenProvider, requireCSRFCheckActionMethods inherited from interface play.filters.components.GzipFilterComponents
gzipFilter, gzipFilterConfigMethods inherited from interface play.components.HttpComponents
actionCreator, httpRequestHandler, javaHandlerComponentsMethods inherited from interface play.components.HttpConfigurationComponents
httpConfiguration, sessionConfigurationMethods inherited from interface play.components.HttpErrorHandlerComponents
httpErrorHandler, javaContextComponents, scalaHttpErrorHandlerMethods inherited from interface play.filters.components.IPFilterComponents
environment, ipFilter, ipFilterConfigMethods inherited from interface play.components.PekkoComponents
actorSystem, coordinatedShutdown, executionContext, materializerMethods inherited from interface play.filters.components.RedirectHttpsComponents
environment, redirectHttpsConfiguration, redirectHttpsFilterMethods inherited from interface play.filters.components.SecurityHeadersComponents
securityHeadersConfig, securityHeadersFilter
-
Method Details
-
httpFilters
Description copied from interface:HttpComponentsList of filters, typically provided by mixing in play.filters.HttpFiltersComponents or play.api.NoHttpFiltersComponents.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 }- Specified by:
httpFiltersin interfaceHttpComponents- Returns:
- an array with the http filters.
- See Also:
-