Class SessionResponse


  • public class SessionResponse
    extends Object
    This SessionResponse class represents a SessionResponse XML document. The SessionResponse DTD is defined as the following:

         <?xml version="1.0">
         < !DOCTYPE SessionResponse [
         < !ELEMENT SessionResponse(GetSession |
                                        GetValidSessions |
                                        DestroySession |
                                        Logout |
                                        AddSessionListener |
                                        AddSessionListenerOnAllSessions |
                                        SetProperty |
                                        GetSessionCount)>
         < !ATTLIST SessionResponse
             vers   CDATA #REQUIRED
             reqid  CDATA #REQUIRED>
         < !ELEMENT GetSession (Session|Exception)>
         < !ELEMENT GetValidSessions ((SessionList Status)|Exception)>
         < !ELEMENT DestroySession (OK|Exception)>
         < !ELEMENT Logout (OK|Exception)>
         < !ELEMENT AddSessionListener (OK|Exception)>
         < !ELEMENT AddSessionListenerOnAllSessions (OK|Exception)>
         < !ELEMENT SetProperty (OK|Exception)>
         < !ELEMENT GetSessionCount (AllSessionsGivenUUID|Exception)>
         < !ELEMENT SessionExpirationTimeInfo>
         < !ATTLIST SessionExpirationTimeInfo
             sid        CDATA #REQUIRED
             expTime    CDATA #REQUIRED>
         < !ELEMENT AllSessionsGivenUUID (SessionExpirationTimeInfo)*>
         < !ELEMENT Session (Property)*>
         < !ATTLIST Session
             sid        CDATA #REQUIRED
             stype      (user|application) "user"
             cid        CDATA #REQUIRED
             cdomain    CDATA #REQUIRED
             maxtime    CDATA #REQUIRED
             maxidle    CDATA #REQUIRED
             maxcaching CDATA #REQUIRED
             timeleft   CDATA #REQUIRED
             timeidle   CDATA #REQUIRED   
             state   (invalid|valid|inactive|destroyed) "invalid">
         < !ELEMENT Property>
         < !ATTLIST Property
             name   CDATA #REQUIRED
             value  CDATA #REQUIRED>
         < !ELEMENT SessionList (Session)*>
         < !ELEMENT OK (#PCDATA)>
         < !ELEMENT Exception (#PCDATA)>
         < !ELEMENT Status (#PCDATA)>
         ]>
     

    • Constructor Detail

      • SessionResponse

        public SessionResponse​(String reqid,
                               int method)
        This constructor shall only be used at the server side to construct a SessionResponse object.
        Parameters:
        reqid - The original SessionRequest ID.
        method - The method ID of the original Session Request.
    • Method Detail

      • parseXML

        public static SessionResponse parseXML​(String xml)
                                        throws SessionException
        This method is used primarily at the client side to reconstruct a SessionResponse object based on the XML document received from server. The DTD of this XML document is described above.
        Parameters:
        xml - The SessionResponse XML document.
        Throws:
        SessionException
      • getResponseVersion

        public String getResponseVersion()
        Returns the response version.
        Returns:
        The response version.
      • getRequestID

        public String getRequestID()
        Returns the request ID.
        Returns:
        The request ID.
      • getMethodID

        public int getMethodID()
        Returns the method ID.
        Returns:
        The method ID.
      • addSessionInfo

        public void addSessionInfo​(SessionInfo info)
        Adds a SessionInfo object.
      • getSessionInfo

        public List<SessionInfo> getSessionInfo()
        Returns the SessionInfo.
        Returns:
        Set containing the session information
      • setSessionInfo

        public void setSessionInfo​(List<SessionInfo> infos)
        Sets the SessionInfo.
        Parameters:
        infos - set containing the session information.
      • setBooleanFlag

        public void setBooleanFlag​(boolean flag)
        Sets the flag.
        Parameters:
        flag -
      • getBooleanFlag

        public boolean getBooleanFlag()
        Returns the flag.
        Returns:
        flag true if the flag is set, false otherwise
      • addSessionForGivenUUID

        public void addSessionForGivenUUID​(String sid,
                                           Long expTime)
        Adds the Session Information for a User.
        Parameters:
        sid - Session ID.
        expTime - time when the session would expire.
      • setSessionsForGivenUUID

        public void setSessionsForGivenUUID​(Map sessions)
        Sets the Sessions.
        Parameters:
        sessions - number for sessions for the user.
      • getSessionsForGivenUUID

        public Map getSessionsForGivenUUID()
        Returns the Session Information for a User.
        Returns:
        list sessions for the user
      • getException

        public String getException()
        Returns the exception.
        Returns:
        The exception.
      • setException

        public void setException​(String ex)
        Sets the exception.
        Parameters:
        ex - Exception.
      • getStatus

        public int getStatus()
        Returns the status.
        Returns:
        The status.
      • setStatus

        public void setStatus​(int value)
        Sets the status.
        Parameters:
        value - Status.
      • toXMLString

        public String toXMLString()
        Translates the response to an XML document String based on the SessionResponse DTD described above.
        Returns:
        An XML String representing the response.