Class SessionRequest


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

         <?xml version="1.0">
         < !DOCTYPE SessionRequest [
         < !ELEMENT SessionRequest (GetSession |
                                       GetValidSessions |
                                       DestroySession |
                                       Logout |
                                       AddSessionListener |
                                       AddSessionListenerOnAllSessions |
                                       SetProperty |
                                       GetSessionCount)>
         < !ATTLIST SessionRequest
             vers   CDATA #REQUIRED
             reqid  CDATA #REQUIRED>
         < !-- This attribute carries the requester identity info -->
              requester  CDATA #IMPLIED>
         < !ELEMENT GetSession (SessionID)>
         < !-- This attribute indicates whether resets 
         the latest access time -->
             reset  CDATA #REQUIRED>
         < !ELEMENT GetValidSessions (SessionID Pattern?)>
         < !ELEMENT DestroySession (SessionID, DestroySessionID)>
         < !ELEMENT Logout (SessionID)>
         < !ELEMENT AddSessionListener (SessionID, URL)>
         < !ELEMENT AddSessionListenerOnAllSessions (SessionID, URL)>
         < !ELEMENT SetProperty (SessionID, Property)>
         < !ATTLIST Property
             name   CDATA #REQUIRED
             value  CDATA #REQUIRED>
         < !ELEMENT SessionID (#PCDATA)>
         < !ELEMENT DestroySessionID (#PCDATA)>
         < !ELEMENT URL (#PCDATA)>
         < !ELEMENT GetSessionCount (SessionID, UUID)>
         < !ELEMENT UUID (#PCDATA)>
         < !ELEMENT Pattern (#PCDATA)>
         ]>
     

    • Constructor Detail

      • SessionRequest

        public SessionRequest​(int method,
                              String sid,
                              boolean reset)
        This constructor shall only be used at the client side to construct a SessionRequest object.
        Parameters:
        method - The method ID of the SessionRequest.
        sid - The session ID required by the SessionRequest.
        reset - The flag to indicate whether this request needs to update the latest session access time.
    • Method Detail

      • parseXML

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

        public String getRequestVersion()
        Returns the request version.
        Returns:
        The request 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.
      • getMethodName

        public String getMethodName()
        Returns:
        The method name.
      • getSessionID

        public String getSessionID()
        Returns the session ID.
        Returns:
        Session ID.
      • setRequester

        public void setRequester​(String requester)
        Sets the requester.
        Parameters:
        requester - Session requester.
      • getRequester

        public String getRequester()
        Returns the requester
        Returns:
        id Session requester.
      • getResetFlag

        public boolean getResetFlag()
        Returns the reset flag.
        Returns:
        The reset flag.
      • setDestroySessionID

        public void setDestroySessionID​(String id)
        Sets the ID of the session to be destroyed.
        Parameters:
        id - The ID of the session to be destroyed.
      • getDestroySessionID

        public String getDestroySessionID()
        Returns the ID of the session to be destroyed.
        Returns:
        The ID of the session to be destroyed.
      • setNotificationURL

        public void setNotificationURL​(String url)
        Sets the notification URL.
        Parameters:
        url - The notification URL.
      • getNotificationURL

        public String getNotificationURL()
        Returns the notification URL.
        Returns:
        The notification URL.
      • setPropertyName

        public void setPropertyName​(String name)
        Sets the property name.
        Parameters:
        name - The property name.
      • getPropertyName

        public String getPropertyName()
        Returns the property name.
        Returns:
        The property name.
      • setPropertyValue

        public void setPropertyValue​(String value)
        Sets the property value.
        Parameters:
        value - The property value.
      • getPropertyValue

        public String getPropertyValue()
        Returns the property value.
        Returns:
        The property value.
      • setPattern

        public void setPattern​(String value)
        Sets the pattern value. Process escape chars in pattern with CDATA.
        Parameters:
        value - The pattern value.
      • getPattern

        public String getPattern()
        Returns the pattern value.
        Returns:
        The pattern value.
      • setUUID

        public void setUUID​(String id)
        Sets the universal unique identifier.
        Parameters:
        id - The universal unique identifier.
      • getUUID

        public String getUUID()
        Returns the universal unique identifier
        Returns:
        The universal unique identifier
      • toXMLString

        public String toXMLString()
        This method translates the request to an XML document String based on the SessionRequest DTD described above. The ID of the session to be destroyed has to be set for method DestroySession. The notification URL has to be set for both methods AddSessionListener and AddSessionListenerOnAllSessions. otherwise, the returns null.
        Returns:
        An XML String representing the request.