Class RedirectWhenSystemIsNotInitializedFilter

  • 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

    public class RedirectWhenSystemIsNotInitializedFilter
    extends AbstractCheckedUriFilter

    Filter which takes care of redirection of the current request in case the system will be recognized as not initialized. Filter Spring configuration requires redirect URL map to which request is redirected to and optionally list of excluded URLs for which redirecting will not work. You are able to provide a specific for tenant redirect url in case system is not initialized. Ther is a DEFAULT entry which will be used to redirect if no specific url found for current tenant id. In standard web application list of excluded URLs will contain for instance static directory which contains all static assets like CSS files, JavaScript files and images and login page. Note that filter will automatically add redirectUrls entry to list of excluded URLs. Additionally filter sets request attribute initialized to TRUE or FALSE depending on initialization status.

    Sample configuration:
       <bean id="redirectFilter" class="de.hybris.platform.servicelayer.web.RedirectWhenSystemIsNotInitializedFilter" scope="tenant">
         <constructor-arg>
          <util:map>
                            <entry key="DEFAULT" value="/platform/init"/>
                            <entry key="junit" value="/test"/>
                    </util:map>
         </constructor-arg>
         <property name="urlPaths">
           <list>
             <value>login</value>
             <value>static</value>
           </list>
         </property>
       </bean>
     
    • Field Summary

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

        logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      void doFilter​(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain)  
      • Methods inherited from class org.springframework.web.filter.GenericFilterBean

        addRequiredProperty, 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 Detail

      • RedirectWhenSystemIsNotInitializedFilter

        public RedirectWhenSystemIsNotInitializedFilter​(java.util.Map<java.lang.String,​java.lang.String> redirectUrls)
      • RedirectWhenSystemIsNotInitializedFilter

        public RedirectWhenSystemIsNotInitializedFilter​(java.lang.String defaultRedirectUrl)
    • Method Detail

      • doFilter

        public void doFilter​(javax.servlet.ServletRequest request,
                             javax.servlet.ServletResponse response,
                             javax.servlet.FilterChain filterChain)
                      throws java.io.IOException,
                             javax.servlet.ServletException
        Throws:
        java.io.IOException
        javax.servlet.ServletException
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws javax.servlet.ServletException
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Overrides:
        afterPropertiesSet in class org.springframework.web.filter.GenericFilterBean
        Throws:
        javax.servlet.ServletException