Class RestServiceUtilsImpl

    • Constructor Detail

      • RestServiceUtilsImpl

        public RestServiceUtilsImpl()
    • Method Detail

      • getProfileIdCookieValue

        public String getProfileIdCookieValue​(javax.servlet.http.HttpServletRequest httpServletRequest)
        Description copied from interface: RestServiceUtils
        Try to extract the current visitor profileId from the current request cookies.
        Specified by:
        getProfileIdCookieValue in interface RestServiceUtils
        Parameters:
        httpServletRequest - the current HTTP request
        Returns:
        the profileId if found in the cookies, null otherwise
      • initEventsRequest

        public EventsRequestContext initEventsRequest​(String scope,
                                                      String sessionId,
                                                      String profileId,
                                                      String personaId,
                                                      boolean invalidateProfile,
                                                      boolean invalidateSession,
                                                      javax.servlet.http.HttpServletRequest request,
                                                      javax.servlet.http.HttpServletResponse response,
                                                      Date timestamp)
        Description copied from interface: RestServiceUtils
        This method is used to initialize the context for a request that would require executing events. It will load existing profile/session for current user or build new ones if necessary IT will also handle anonymous profile/session preferences in case there is specific ones. It will also handle persona in case it is provided And finally it will provide a contextual bean named: EventsRequestContext, that will contain all the required information for the next steps of the request, like: processing the events
        Specified by:
        initEventsRequest in interface RestServiceUtils
        Parameters:
        scope - the current scope (mandatory, in case session need to be created)
        sessionId - the current sessionId (mandatory)
        profileId - the current profileId (optional in case profile doesn't exists yet for incoming visitor)
        personaId - the current personaId (optional in case we don't want to apply persona on current request)
        invalidateProfile - true in case we want to invalidate the current visitor profile, false otherwise
        invalidateSession - true in case we want to invalidate the current visitor session, false otherwise
        request - the current request
        response - the current request response
        timestamp - the current date, for timestamp the current visitor data
        Returns:
        the built EventsRequestContext
      • finalizeEventsRequest

        public void finalizeEventsRequest​(EventsRequestContext eventsRequestContext,
                                          boolean crashOnError)
        Description copied from interface: RestServiceUtils
        At the end of an events requests we want to save/update the profile and/or the session depending on the changes Also we want to return a cookie about current visitor profile ID
        Specified by:
        finalizeEventsRequest in interface RestServiceUtils
        Parameters:
        eventsRequestContext - the current EventsRequestContext
        crashOnError - true if we want to throw an Exception in case of errors during events execution, false otherwise (otherwise, no exception, but just an error code directly returned to the HTTP response)