Class 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.
    • Constructor Detail

      • CMSPreviewTicketFilter

        public CMSPreviewTicketFilter()
    • 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
      • 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 request
        response - - the http servlet response
        previewData - - the preview data
        Returns:
        true when the request needs to be redirected, otherwise false
      • 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 response
        redirectUrl - - 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
      • setCmsPreviewService

        public void setCmsPreviewService​(CMSPreviewService cmsPreviewService)
      • setCommerceCommonI18NService

        public void setCommerceCommonI18NService​(CommerceCommonI18NService commerceCommonI18NService)
      • setBaseSiteService

        public void setBaseSiteService​(BaseSiteService baseSiteService)
      • setCatalogVersionService

        public void setCatalogVersionService​(CatalogVersionService catalogVersionService)
      • setSessionService

        public void setSessionService​(SessionService sessionService)
      • getTimeService

        protected TimeService getTimeService()
      • setTimeService

        public void setTimeService​(TimeService timeService)
      • setPageRedirectStrategy

        public void setPageRedirectStrategy​(PageRedirectStrategy pageRedirectStrategy)