Class BaseSiteFilter

  • 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 BaseSiteFilter
    extends org.springframework.web.filter.OncePerRequestFilter
    Request filter that resolves base site uid from restful request mapping, i.e
    /rest/v1/mysite/cart, or
    /rest/v1/mysite/customers/current
    would try to set base site with uid=mysite as a current site.
    One should define the path which is expected to be before the site resource in the project properties file (commercewebservices.rootcontext).
    Default and fallback value equals to /rest/v1/
    The method uses also a comma separated list of url special characters that are used to parse the site id resource. You can reconfigure it in properties file (commercewebservices.url.special.characters). The default and fallback value is equal to "?,/". Filter will throw ServletException if it fails to find the site which is in the resource url.
    However, you can configure exceptions that doesnt require the site mapping in the resource path. You can configure them in a spring bean called 'baseFilterResourceExceptions'.
    • 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
      BaseSiteFilter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doFilterInternal​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)  
      ContextInformationLoader getContextInformationLoader()  
      protected void processRequest​(javax.servlet.http.HttpServletRequest httpRequest)  
      void setContextInformationLoader​(ContextInformationLoader contextInformationLoader)  
      • Methods inherited from class org.springframework.web.filter.OncePerRequestFilter

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

      • BaseSiteFilter

        public BaseSiteFilter()
    • Method Detail

      • doFilterInternal

        protected void doFilterInternal​(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        javax.servlet.FilterChain filterChain)
                                 throws javax.servlet.ServletException,
                                        java.io.IOException
        Specified by:
        doFilterInternal in class org.springframework.web.filter.OncePerRequestFilter
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • setContextInformationLoader

        public void setContextInformationLoader​(ContextInformationLoader contextInformationLoader)