Package de.hybris.platform.cmsocc.filter
Class CMSPreviewTicketFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
de.hybris.platform.cmsocc.filter.CMSPreviewTicketFilter
- 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 CMSPreviewTicketFilter
extends org.springframework.web.filter.OncePerRequestFilter
Filter that resolves the preview ticket id from the requested url and activates it.
-
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 BaseSiteServiceprotected CatalogVersionServiceprotected CMSPreviewServiceprotected PageRedirectStrategyprotected PreviewDataModelgetPreviewDataModel(String previewTicketId) Retrieves preview data for a given preview ticket idprotected SessionServiceprotected TimeServiceprotected booleanredirectRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PreviewDataModel previewData) Verifies whether a request needs to be redirected when the preview ticket provides a pageId that would override the pageId value defined in the request url.protected voidsendRedirect(javax.servlet.http.HttpServletResponse response, String redirectUrl) Sends the redirect request given the redirect urlvoidsetBaseSiteService(BaseSiteService baseSiteService) voidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetCmsPreviewService(CMSPreviewService cmsPreviewService) voidsetCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService) protected voidsetLanguageInSession(LanguageModel language) Sets the current language in the sessionvoidsetPageRedirectStrategy(PageRedirectStrategy pageRedirectStrategy) voidsetSessionService(SessionService sessionService) protected voidsetSiteInSession(CMSSiteModel site) Sets the current site in the sessionprotected voidsetTimeInSession(Date time) Sets the current time in the sessionvoidsetTimeService(TimeService timeService) 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
-
CMSPreviewTicketFilter
public CMSPreviewTicketFilter()
-
-
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
-
redirectRequest
protected boolean redirectRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PreviewDataModel previewData) Verifies whether a request needs to be redirected when the preview ticket provides a pageId that would override the pageId value defined in the request url. If the request needs to be redirected, it will build the redirect url and perform the redirection.- Parameters:
request- - the http servlet requestresponse- - the http servlet responsepreviewData- - the preview data- Returns:
truewhen the request needs to be redirected, otherwisefalse
-
getPreviewDataModel
Retrieves preview data for a given preview ticket id- Parameters:
previewTicketId- - preview ticket id- Returns:
- preview data model
-
sendRedirect
Sends the redirect request given the redirect url- Parameters:
response- - the current responseredirectUrl- - the redirect url
-
setLanguageInSession
Sets the current language in the session- Parameters:
language- - the language to be set as the current language
-
setTimeInSession
Sets the current time in the session- Parameters:
time- - the time to be set as the current time
-
setSiteInSession
Sets the current site in the session- Parameters:
site- - the site to be set as the current site
-
getCmsPreviewService
-
setCmsPreviewService
-
getCommerceCommonI18NService
-
setCommerceCommonI18NService
-
getBaseSiteService
-
setBaseSiteService
-
getCatalogVersionService
-
setCatalogVersionService
-
getSessionService
-
setSessionService
-
getTimeService
-
setTimeService
-
getPageRedirectStrategy
-
setPageRedirectStrategy
-