Class BaseSiteFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
de.hybris.platform.ycommercewebservices.filter.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.
/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_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 voidprocessRequest(javax.servlet.http.HttpServletRequest httpRequest) voidsetContextInformationLoader(ContextInformationLoader contextInformationLoader) 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
-
BaseSiteFilter
public BaseSiteFilter()
-
-
Method Details
-
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
-
processRequest
protected void processRequest(javax.servlet.http.HttpServletRequest httpRequest) throws InvalidResourceException - Throws:
InvalidResourceException
-
getContextInformationLoader
-
setContextInformationLoader
-