Class RestServiceUtilsImpl

java.lang.Object
org.apache.unomi.rest.service.impl.RestServiceUtilsImpl
All Implemented Interfaces:
RestServiceUtils

public class RestServiceUtilsImpl extends Object implements RestServiceUtils
  • Constructor Details

    • RestServiceUtilsImpl

      public RestServiceUtilsImpl()
  • Method Details

    • 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
    • performEventsRequest

      public EventsRequestContext performEventsRequest(List<Event> events, EventsRequestContext eventsRequestContext)
      Description copied from interface: RestServiceUtils
      Execute the list of events using the dedicated eventsRequestContext
      Specified by:
      performEventsRequest in interface RestServiceUtils
      Parameters:
      events - the list of events to he executed
      eventsRequestContext - the current EventsRequestContext
      Returns:
      an updated version of the current 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)