/** * 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 * @see \AppserverIo\Appserver\ServletEngine\SessionMarshaller::unmarshall() */ public function unmarshall(ServletSessionInterface $servletSession, $marshalled) { // decode the string $decodedSession = json_decode($marshalled); // extract the values $id = $decodedSession->id; $name = $decodedSession->name; $lifetime = $decodedSession->lifetime; $maximumAge = $decodedSession->maximumAge; $domain = $decodedSession->domain; $path = $decodedSession->path; $secure = $decodedSession->secure; $httpOnly = $decodedSession->httpOnly; $data = $decodedSession->data; // initialize the instance $servletSession->init($id, $name, $lifetime, $maximumAge, $domain, $path, $secure, $httpOnly); // append the session data foreach ($data as $key => $value) { $servletSession->putData($key, unserialize($value)); } }