Class CMSPreviewTicketFilter
- java.lang.Object
-
- org.springframework.web.filter.GenericFilterBean
-
- org.springframework.web.filter.OncePerRequestFilter
-
- de.hybris.platform.cmsoccaddon.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.OncePerRequestFilterFilter that resolves the preview ticket id from the requested url and activates it.
-
-
Constructor Summary
Constructors Constructor Description CMSPreviewTicketFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)protected BaseSiteServicegetBaseSiteService()protected CatalogVersionServicegetCatalogVersionService()protected CMSPreviewServicegetCmsPreviewService()CommerceCommonI18NServicegetCommerceCommonI18NService()protected PageRedirectStrategygetPageRedirectStrategy()protected PreviewDataModelgetPreviewDataModel(java.lang.String previewTicketId)Retrieves preview data for a given preview ticket idprotected SessionServicegetSessionService()protected TimeServicegetTimeService()protected 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, java.lang.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(java.util.Date time)Sets the current time in the sessionvoidsetTimeService(TimeService timeService)-
Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatch
-
-
-
-
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:
doFilterInternalin classorg.springframework.web.filter.OncePerRequestFilter- Throws:
javax.servlet.ServletExceptionjava.io.IOException
-
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
protected PreviewDataModel getPreviewDataModel(java.lang.String previewTicketId)
Retrieves preview data for a given preview ticket id- Parameters:
previewTicketId- - preview ticket id- Returns:
- preview data model
-
sendRedirect
protected void sendRedirect(javax.servlet.http.HttpServletResponse response, java.lang.String redirectUrl)Sends the redirect request given the redirect url- Parameters:
response- - the current responseredirectUrl- - the redirect url
-
setLanguageInSession
protected void setLanguageInSession(LanguageModel language)
Sets the current language in the session- Parameters:
language- - the language to be set as the current language
-
setTimeInSession
protected void setTimeInSession(java.util.Date time)
Sets the current time in the session- Parameters:
time- - the time to be set as the current time
-
setSiteInSession
protected void setSiteInSession(CMSSiteModel site)
Sets the current site in the session- Parameters:
site- - the site to be set as the current site
-
getCmsPreviewService
protected CMSPreviewService getCmsPreviewService()
-
setCmsPreviewService
public void setCmsPreviewService(CMSPreviewService cmsPreviewService)
-
getCommerceCommonI18NService
public CommerceCommonI18NService getCommerceCommonI18NService()
-
setCommerceCommonI18NService
public void setCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService)
-
getBaseSiteService
protected BaseSiteService getBaseSiteService()
-
setBaseSiteService
public void setBaseSiteService(BaseSiteService baseSiteService)
-
getCatalogVersionService
protected CatalogVersionService getCatalogVersionService()
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
getSessionService
protected SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getTimeService
protected TimeService getTimeService()
-
setTimeService
public void setTimeService(TimeService timeService)
-
getPageRedirectStrategy
protected PageRedirectStrategy getPageRedirectStrategy()
-
setPageRedirectStrategy
public void setPageRedirectStrategy(PageRedirectStrategy pageRedirectStrategy)
-
-