public function unmarshall(ServletSessionInterface $servletSession, $marshalled)
    {

        // try to decode the string
        $decodedSession = json_decode($marshalled, true);

        // query whether or not the session data has been encoded successfully
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new SessionDataNotReadableException(json_last_error_msg());
        }

        // extract the values
        $id = $decodedSession[StandardSessionMarshaller::ID];
        $name = $decodedSession[StandardSessionMarshaller::NAME];
        $lifetime = $decodedSession[StandardSessionMarshaller::LIFETIME];
        $maximumAge = $decodedSession[StandardSessionMarshaller::MAXIMUM_AGE];
        $domain = $decodedSession[StandardSessionMarshaller::DOMAIN];
        $path = $decodedSession[StandardSessionMarshaller::PATH];
        $secure = $decodedSession[StandardSessionMarshaller::SECURE];
        $httpOnly = $decodedSession[StandardSessionMarshaller::HTTP_ONLY];
        $data = $decodedSession[StandardSessionMarshaller::DATA];
        $lastActivityTimestamp = $decodedSession[StandardSessionMarshaller::LAST_ACTIVITY_TIMESTAMP];

        // initialize the instance
        $servletSession->init($id, $name, $lifetime, $maximumAge, $domain, $path, $secure, $httpOnly, $lastActivityTimestamp);

        // append the session data
        foreach ($data as $key => $value) {
            $servletSession->putData($key, unserialize($value));
        }
    }
public function unmarshall(ServletSessionInterface $servletSession, $marshalled)
    {

        // try to decode the string
        $decodedSession = json_decode($marshalled, true);

        // query whether or not the session data has been encoded successfully
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new SessionDataNotReadableException(json_last_error_msg());
        }

        // extract the values
        $id = $decodedSession[StandardSessionMarshaller::ID];
        $name = $decodedSession[StandardSessionMarshaller::NAME];
        $lifetime = $decodedSession[StandardSessionMarshaller::LIFETIME];
        $maximumAge = $decodedSession[StandardSessionMarshaller::MAXIMUM_AGE];
        $domain = $decodedSession[StandardSessionMarshaller::DOMAIN];
        $path = $decodedSession[StandardSessionMarshaller::PATH];
        $secure = $decodedSession[StandardSessionMarshaller::SECURE];
        $httpOnly = $decodedSession[StandardSessionMarshaller::HTTP_ONLY];
        $data = $decodedSession[StandardSessionMarshaller::DATA];
        $lastActivityTimestamp = $decodedSession[StandardSessionMarshaller::LAST_ACTIVITY_TIMESTAMP];

        // initialize the instance
        $servletSession->init($id, $name, $lifetime, $maximumAge, $domain, $path, $secure, $httpOnly, $lastActivityTimestamp);

        // append the session data
        foreach ($data as $key => $value) {
            $servletSession->putData($key, unserialize($value));
        }
    }
public function unmarshall ( ServletSessionInterface $ servletSession , $ marshalled ) { // try to decode the string $ decodedSession = json_decode ( $ marshalled , true ) ; // query whether or not the session data has been encoded successfully if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new SessionDataNotReadableException ( json_last_error_msg ( ) ) ; } // extract the values $ id = $ decodedSession [ StandardSessionMarshaller :: ID ] ; $ name = $ decodedSession [ StandardSessionMarshaller :: NAME ] ; $ lifetime = $ decodedSession [ StandardSessionMarshaller :: LIFETIME ] ; $ maximumAge = $ decodedSession [ StandardSessionMarshaller :: MAXIMUM_AGE ] ; $ domain = $ decodedSession [ StandardSessionMarshaller :: DOMAIN ] ; $ path = $ decodedSession [ StandardSessionMarshaller :: PATH ] ; $ secure = $ decodedSession [ StandardSessionMarshaller :: SECURE ] ; $ httpOnly = $ decodedSession [ StandardSessionMarshaller :: HTTP_ONLY ] ; $ data = $ decodedSession [ StandardSessionMarshaller :: DATA ] ; $ lastActivityTimestamp = $ decodedSession [ StandardSessionMarshaller :: LAST_ACTIVITY_TIMESTAMP ] ; // initialize the instance $ servletSession -> init ( $ id , $ name , $ lifetime , $ maximumAge , $ domain , $ path , $ secure , $ httpOnly , $ lastActivityTimestamp ) ; // append the session data foreach ( $ data as $ key => $ value ) { $ servletSession -> putData ( $ key , unserialize ( $ value ) ) ; } }
Initializes the session instance from the passed JSON string. If the encoded
data contains objects, they will be un-serialized before reattached to the
session instance.

@param \AppserverIo\Psr\Servlet\ServletSessionInterface $servletSession The empty session instance we want the un-marshaled data be added to
@param string                                           $marshalled     The marshaled session representation

@return \AppserverIo\Psr\Servlet\ServletSessionInterface The decoded session instance
@throws \AppserverIo\Appserver\ServletEngine\SessionDataNotReadableException Is thrown, if the session data can not be unmarshalled
@see \AppserverIo\Appserver\ServletEngine\SessionMarshallerInterface::unmarshall()
Initializes the session instance from the passed JSON string . If the encoded data contains objects they will be un - serialized before reattached to the session instance .