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 Classes
    Modifier and Type
    Class
    Description
    class 
    Simple & 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_SUFFIX

    Fields inherited from class org.springframework.web.filter.GenericFilterBean

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractPlatformFilterChain(List<javax.servlet.Filter> internalFilters)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)
     
    protected Collection<String>
     
    protected abstract boolean
    Returns true if filter is used in backoffice application.
    void
    setExcludedUrlPaths(List<String> excludedUrlPaths)
     
    void
     
    protected void
     
    protected boolean
     
    protected static <E extends Throwable>
    void
     
    protected static void
     

    Methods inherited from class org.springframework.web.filter.OncePerRequestFilter

    doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatch

    Methods inherited from class org.springframework.web.filter.GenericFilterBean

    addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractPlatformFilterChain

      public AbstractPlatformFilterChain(List<javax.servlet.Filter> internalFilters)
  • Method Details

    • getExcludedUrlPaths

      protected Collection<String> getExcludedUrlPaths()
    • setExcludedUrlPaths

      public void setExcludedUrlPaths(List<String> excludedUrlPaths)
    • setPreFilter

      public void setPreFilter(AbstractPlatformPreFilter preFilter)
    • setStatisticsConfig

      protected void setStatisticsConfig(StatisticsConfig statisticsConfig)
    • 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:
      doFilterInternal in class org.springframework.web.filter.OncePerRequestFilter
      Throws:
      javax.servlet.ServletException
      IOException
    • isBackOfficeFilterChain

      protected abstract boolean isBackOfficeFilterChain()
      Returns true if filter is used in backoffice application.
    • shouldBreakFiltering

      protected boolean shouldBreakFiltering(String requestURI)
    • throwUncheckedException

      protected static void throwUncheckedException(Throwable exception)
    • throwAnyException

      protected static <E extends Throwable> void throwAnyException(Throwable exception) throws E
      Throws:
      E extends Throwable