Class AbstractPlatformFilterChain
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain
- All Implemented Interfaces:
javax.servlet.Filter,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.EnvironmentAware,org.springframework.core.env.EnvironmentCapable,org.springframework.web.context.ServletContextAware
- Direct Known Subclasses:
BackOfficeFilterChain,PlatformFilterChain
public abstract class AbstractPlatformFilterChain
extends org.springframework.web.filter.OncePerRequestFilter
Instead of implementing all the different feature into one Filter this filter just provides a internal chain where
you can add different other filters to add additional features to your request processing.
As these filters are part of the internal chain, they are only triggered if this filter is triggered, therefore the
same filter mapping configuration is automatically applied.
This filter is extending the OncePerRequestFilter class provided by Spring in order to ensure, that the filter (and
the configured filter of the internal chain) is only called once.
There are several filters available providing a standard set of features like tenant handling, session handling and
catalog version handling. You can simply add these filter to the internal chain by configuring the spring bean
definition accordingly.
This filter should be configured in the Spring configuration file of your web application and provide a list of bean
ids of the beans which should be used in the internal chain as constructor arguments.
<bean id="aggregationFilter" class="de.hybris.platform.servicelayer.web.AggregationFilter">
<constructor-arg>
<list>
<ref bean="profileFilter"/>
<ref bean="log4jFilter"/>
<ref bean="tenantActivationFilter"/>
<ref bean="sessionFilter"/>
<ref bean="simpleCatalogVersionFilter"/>
</list>
</constructor-arg>
</bean>
In order to use this configured bean instance in your web application, you now have to configure the
DelegatingFilterProxy in the web.xml your web application in order to for your configured aggregationFilter
to be called during request processing. Do not forget to also define the filter mapping to be used:
<filter-mapping>
<filter-name>platformFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Right now there are no filters which allow you to have the following functionality, which have been provided by the
WebSessionFunctions:
* Dynamic tenant handling: Switching the tenant dynamically by specifying the tenantId as a query parameter. * System Init check: Checking for each request if the hybris system is initialized. * Status pages: Serving special pages to the client if the system is currently shutting down or a special info token is provided.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassSimple & straight forward implementation of the FilterChain interface used by the PlatformFilterChain for it's internal chain. -
Field Summary
Fields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIXFields inherited from class org.springframework.web.filter.GenericFilterBean
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain) protected Collection<String>protected abstract booleanReturns true if filter is used in backoffice application.voidsetExcludedUrlPaths(List<String> excludedUrlPaths) voidsetPreFilter(AbstractPlatformPreFilter preFilter) protected voidsetStatisticsConfig(StatisticsConfig statisticsConfig) protected booleanshouldBreakFiltering(String requestURI) protected static <E extends Throwable>
voidthrowAnyException(Throwable exception) protected static voidthrowUncheckedException(Throwable exception) Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatchMethods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
Constructor Details
-
AbstractPlatformFilterChain
-
-
Method Details
-
getExcludedUrlPaths
-
setExcludedUrlPaths
-
setPreFilter
-
setStatisticsConfig
-
doFilterInternal
protected void doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain) throws javax.servlet.ServletException, IOException - Specified by:
doFilterInternalin classorg.springframework.web.filter.OncePerRequestFilter- Throws:
javax.servlet.ServletExceptionIOException
-
isBackOfficeFilterChain
protected abstract boolean isBackOfficeFilterChain()Returns true if filter is used in backoffice application. -
shouldBreakFiltering
-
throwUncheckedException
-
throwAnyException
- Throws:
E extends Throwable
-