Class UserContext


  • @API(src=PUBLIC,
         type=NOT_EXTENDABLE)
    public class UserContext
    extends java.lang.Object
    The context of the user that opened the URL.
    Since:
    17
    • Constructor Summary

      Constructors 
      Constructor Description
      UserContext​(java.util.Map<java.lang.String,​java.lang.String> headersMap, java.lang.String sessionId)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.String> getCookies()  
      java.util.Map<java.lang.String,​java.lang.String> getHeaders()  
      java.lang.String getSessionId()  
      boolean isServiceAccount()
      UserContext is used both for real users connected with their web browser and for plugins that try to open an URL on their own behalf.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UserContext

        public UserContext​(java.util.Map<java.lang.String,​java.lang.String> headersMap,
                           java.lang.String sessionId)
        Parameters:
        headersMap - The cookies that are part of the context of this URL.
        sessionId - The session ID of the user.
    • Method Detail

      • getCookies

        public java.util.Map<java.lang.String,​java.lang.String> getCookies()
        Returns:
        Returns the cookies.
      • getHeaders

        public java.util.Map<java.lang.String,​java.lang.String> getHeaders()
        Returns:
        the an immutable request headers map.
      • getSessionId

        public java.lang.String getSessionId()
        Returns:
        The id of the session of the user maintained by the Servlet container.
      • isServiceAccount

        public boolean isServiceAccount()
        UserContext is used both for real users connected with their web browser and for plugins that try to open an URL on their own behalf. For example, in a concurrent editing session, users join and leave. In order to have a robust way to save changes, a plugin may choose to use a dedicated set of credentials that do not belong to any of those users. Such credentials belong to a "service account".
        Returns:
        false if the user context represents a real user connected with their web browser.