This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Why is HttpServlet Serializable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Why is HttpServlet Serializable?" Watch "Why is HttpServlet Serializable?" New topic
Author

Why is HttpServlet Serializable?

Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Hi Friends,

Why is HttpServlet (or GenericServlet) Serializable?

Same for HttpSessionBindingEvent, HttpSessionEvent, ServletContextEvent, ServletContextAttributeEvent.

They seem to live forever in the container, never travel outside of it. I have not noticed they have to be persisted either. So why is the need for serialization?

I appreciate your opinions.


We must know, we will know. -- David Hilbert
Joan Horta Tosas
Ranch Hand

Joined: Feb 01, 2007
Posts: 59
I'm not sure, but I think it's to allow the container to persist their state and "suspend/resume" them according to their use, pooling, etc... I can't think of another reason.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

And clustering
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why is HttpServlet Serializable?
 
Similar Threads
Why HttpServlet implements Serializable interface
is Serialization Inherited
GenericServlet Vs HttpServlet
extending a class which implements Serializable
HttpServlet implementing Serializable