Class ContextRequest


  • public class ContextRequest
    extends Object
    An incoming request for context information from clients of the context server. This allows clients to specify which type of information they are interested in getting from the context server as well as specify incoming events or content filtering or property/segment overrides for personalization or impersonation. This conditions what the context server will return with its response.

    Events that are generated on the client as part of its functioning can be specified in the client as part of its request for contextual data. The context server will deliver these events to EventListenerServices to be processed. In particular, the RulesService will trigger any applicable Rule which in turn might trigger Actions. An appropriate Event is also triggered when a Rule matches so that other rules can react to it. Finally, an event will also be emitted if the user Profile has been updated as part of the event processing.

    A client wishing to perform content personalization might also specify filtering condition to be evaluated by the context server so that it can tell the client whether the content associated with the filter should be activated for this profile/session.

    It is also possible to clients wishing to perform user impersonation to specify properties or segment to override the proper ones so as to emulate a specific profile, in which case the overridden value will temporarily replace the proper values so that all rules will be evaluated with these values instead of the proper ones.

    See Also:
    ContextResponse, Event
    • Constructor Detail

      • ContextRequest

        public ContextRequest()
    • Method Detail

      • getSource

        public Item getSource()
        Retrieves the source of the context request.
        Returns:
        the source
      • setSource

        public void setSource​(Item source)
        Sets the source.
        Parameters:
        source - the source
      • isRequireSegments

        public boolean isRequireSegments()
        Determines whether or not the context server should return the segments associated with the profile from which the request was issued.
        Returns:
        true if the context server should return the profile segments, false otherwise
        See Also:
        ContextResponse.getProfileSegments()
      • setRequireSegments

        public void setRequireSegments​(boolean requireSegments)
        Specifies whether to return the profile segments with the response.
        Parameters:
        requireSegments - true if the context server should return the profile segments, false otherwise
      • getRequiredProfileProperties

        public List<String> getRequiredProfileProperties()
        Retrieves the list of profile properties the context server should return with its context response.
        Returns:
        the required profile properties the client requested to be returned with the response
        See Also:
        ContextResponse.getProfileProperties()
      • setRequiredProfileProperties

        public void setRequiredProfileProperties​(List<String> requiredProfileProperties)
        Specifies which profile properties should be returned with the response.
        Parameters:
        requiredProfileProperties - the profile properties that should be returned with the response
      • getRequiredSessionProperties

        public List<String> getRequiredSessionProperties()
        Retrieves the list of session properties the context server should return with its context response.
        Returns:
        the required session properties the client requested to be returned with the response
        See Also:
        ContextResponse.getSessionProperties()
      • setRequiredSessionProperties

        public void setRequiredSessionProperties​(List<String> requiredSessionProperties)
        Specifies which session properties should be returned with the response.
        Parameters:
        requiredSessionProperties - the session properties that should be returned with the response
      • isRequireScores

        public boolean isRequireScores()
        Specifies whether the profiles scores should be part of the ContextResponse.
        Returns:
        a boolean indicating if the scores should be part of the response.
      • setRequireScores

        public void setRequireScores​(boolean requireScores)
        Setting this value to true indicates that the profile scores should be included in the response. By default this value is false.
        Parameters:
        requireScores - set to true if you want the scores to be part of the context response
      • getEvents

        public List<Event> getEvents()
        Retrieves the events that the client has generated as part of its processes and wishes the context server to process.
        Returns:
        the client events to be processed by the context server
        See Also:
        Event
      • setEvents

        public void setEvents​(List<Event> events)
        Specifies the events to be processed by the context server.
        Parameters:
        events - the events to be processed by the context server
      • getProfileOverrides

        public Profile getProfileOverrides()
        Retrieves the profile overrides.
        Returns:
        the profile overrides
      • setProfileOverrides

        public void setProfileOverrides​(Profile overrides)
        Sets the profile overrides.
        Parameters:
        overrides - the profile overrides
      • getSessionPropertiesOverrides

        public Map<String,​Object> getSessionPropertiesOverrides()
        Retrieves the session properties overrides.
        Returns:
        the session properties overrides
      • setSessionPropertiesOverrides

        public void setSessionPropertiesOverrides​(Map<String,​Object> sessionPropertiesOverrides)
        Sets the session properties overrides.
        Parameters:
        sessionPropertiesOverrides - the session properties overrides
      • getSessionId

        public String getSessionId()
        Retrieve the sessionId passed along with the request. All events will be processed with this sessionId as a default
        Returns:
        the identifier for the session
      • setSessionId

        public void setSessionId​(String sessionId)
        Sets the sessionId in the request. This is the preferred method of passing along a session identifier with the request, as passing it along in the URL can lead to potential security vulnerabilities.
        Parameters:
        sessionId - an unique identifier for the session
      • getProfileId

        public String getProfileId()
        Retrieve the profileId passed along with the request. All events will be processed with this profileId as a default
        Returns:
        the identifier for the profile
      • setProfileId

        public void setProfileId​(String profileId)
        Sets the profileId in the request.
        Parameters:
        profileId - an unique identifier for the profile
      • getClientId

        public String getClientId()
      • setClientId

        public void setClientId​(String clientId)