Class RestServiceUtilsImpl
- java.lang.Object
-
- org.apache.unomi.rest.service.impl.RestServiceUtilsImpl
-
- All Implemented Interfaces:
RestServiceUtils
public class RestServiceUtilsImpl extends Object implements RestServiceUtils
-
-
Constructor Summary
Constructors Constructor Description RestServiceUtilsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalizeEventsRequest(EventsRequestContext eventsRequestContext, boolean crashOnError)
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 IDString
getProfileIdCookieValue(javax.servlet.http.HttpServletRequest httpServletRequest)
Try to extract the current visitor profileId from the current request cookies.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)
This method is used to initialize the context for a request that would require executing events.EventsRequestContext
performEventsRequest(List<Event> events, EventsRequestContext eventsRequestContext)
Execute the list of events using the dedicated eventsRequestContext
-
-
-
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 interfaceRestServiceUtils
- 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 interfaceRestServiceUtils
- 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 otherwiseinvalidateSession
- true in case we want to invalidate the current visitor session, false otherwiserequest
- the current requestresponse
- the current request responsetimestamp
- 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 interfaceRestServiceUtils
- Parameters:
events
- the list of events to he executedeventsRequestContext
- 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 interfaceRestServiceUtils
- Parameters:
eventsRequestContext
- the current EventsRequestContextcrashOnError
- 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)
-
-