Class PageWorkflowInterceptor

  • All Implemented Interfaces:
    org.springframework.web.servlet.AsyncHandlerInterceptor, org.springframework.web.servlet.HandlerInterceptor

    public class PageWorkflowInterceptor
    extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
    Default interceptor to run before the Pages controller's execution to verify if the affected page is already attached to a workflow. If the page is already a workflow attachment, users should not be able to modify it anymore in order to preserve a consistent state. In such case, we return an error in the HTTP response using the status code 409 - Conflict.
    • Constructor Detail

      • PageWorkflowInterceptor

        public PageWorkflowInterceptor()
    • Method Detail

      • preHandle

        public boolean preHandle​(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 java.lang.Object handler)
                          throws java.io.IOException
        Specified by:
        preHandle in interface org.springframework.web.servlet.HandlerInterceptor
        Overrides:
        preHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
        Throws:
        java.io.IOException
      • resolveValueFromRequest

        protected java.lang.String resolveValueFromRequest​(javax.servlet.http.HttpServletRequest request,
                                                           java.lang.String key)
        Retrieves the value associated to the given key from the provided request using the payload or the URL.
        Parameters:
        request - - the HTTP request containing the request body and URL
        key - - the key used to extract the desired value
        Returns:
        the value associated to the provided key; can be null
      • findValueFromRequestPayload

        protected java.lang.String findValueFromRequestPayload​(javax.servlet.http.HttpServletRequest request,
                                                               java.lang.String key)
        Retrieves the value associated to the given key from the provided request payload.
        Parameters:
        request - - the HTTP request containing the request body
        key - - the key used to extract the desired value
        Returns:
        the value associated to the provided key; can be null
      • findValueFromRequestUrl

        protected java.lang.String findValueFromRequestUrl​(javax.servlet.http.HttpServletRequest request,
                                                           java.lang.String key)
        Retrieves the value associated to the given key from the provided request URL: path or query parameter.
        Parameters:
        request - - the HTTP request containing the request URL
        key - - the key used to extract the desired value
        Returns:
        the value associated to the provided key; can be null
      • setCmsAdminPageService

        public void setCmsAdminPageService​(CMSAdminPageService cmsAdminPageService)
      • setCmsAdminContentSlotService

        public void setCmsAdminContentSlotService​(CMSAdminContentSlotService cmsAdminContentSlotService)
      • setCmsWorkflowAttachmentService

        public void setCmsWorkflowAttachmentService​(CMSWorkflowAttachmentService cmsWorkflowAttachmentService)