Class RedirectWhenSystemIsNotInitializedFilter

java.lang.Object
org.springframework.web.filter.GenericFilterBean
de.hybris.platform.servicelayer.web.AbstractCheckedUriFilter
de.hybris.platform.servicelayer.web.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>
 
  • Constructor Details

    • RedirectWhenSystemIsNotInitializedFilter

      public RedirectWhenSystemIsNotInitializedFilter(Map<String,String> redirectUrls)
    • RedirectWhenSystemIsNotInitializedFilter

      public RedirectWhenSystemIsNotInitializedFilter(String defaultRedirectUrl)
  • Method Details

    • doFilter

      public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain) throws IOException, javax.servlet.ServletException
      Throws:
      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