Vaadin 7 (de)serialization questions

In Vaadin 7beta3, the
VaadinServiceSession
class provides a generic way to store data in the session using
setAttribute()
and
getAttribute()
. That’s great - so far so good.

Now consider the case where the HTTP session is serialized and then deserialized, and some object that was stored there via
VaadinServiceSession.setAttribute()
needs to perform custom deserialization logic in its
readObject()
method.

Or more generally, consider any part of the serialized Vaadin session that needs access to the current
VaadinRequest
,
VaadinService
, or
VaadinServiceSession
in order to perform its custom deserialization logic.

What is going to be the state of the
VaadinService
and
VaadinServiceSession
objects at that time (i.e., during deserialization)?

Will
VaadinService.getCurrentRequest()
work?

Will
VaadinService.getCurrent()
work?

Will
VaadinService.getCurrent().findVaadinSession(VaadinService.getCurrentRequest())
work?

Thanks.

I guess that depends on at what point the servlet container deserializes the session. My guess is that it happens either during context startup or the first time HttpServletRequest.getSession() is invoked. The first case will of course not have any of Vaadin’s ThreadLocal instances defined whereas the other might work unless there’s e.g. a Servlet Filter accessing the session before VaadinServlet does so.

Vaadin could in theory use some custom serialization for VaadinServiceSession so that certain data is not deserialized until the first time the session is accessed through VaadinServlet even though that might also screw things up unless very carefully managed.

OK. We need someone who understands serialization to look at this then.

http://dev.vaadin.com/ticket/9953