Search code examples
servletshttpsession

Class requirements for placing object into HttpSession


I am editing a class that is mean to be placed into the session of a servlet use as a key for a hastable of other objects. I do not know what the minimal requirements for an object which can be placed into the HttpSession. what are the minimal requirements for an object which can be placed into the HttpSession?


Solution

  • All objects that are placed in a HttpSession should implement java.io.Serializable.

    That's really the only "minimal" requirement.

    For scalability you generally want to minimise the overall size of objects that you place in the session as well.