aspose file tools*
The moose likes Servlets and the fly likes why do genericServlet and HttpServlet implements serizable inferface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "why do genericServlet and HttpServlet implements serizable inferface" Watch "why do genericServlet and HttpServlet implements serizable inferface" New topic
Author

why do genericServlet and HttpServlet implements serizable inferface

Brij Garg
Ranch Hand

Joined: Apr 29, 2008
Posts: 234
Hi

Can someone explain in details why do genericservlet and httpservlet implements serizable interface?

I just read that servlet engine can hibernate the servlet to store the state of the servlet or to duplicate the servlet instance for better load balancing.

Is there any pitfall of this?
How developer's work effected by this functionality of the servlet engine?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

Originally posted by bittoo garg:
Is there any pitfall of this?
How developer's work effected by this functionality of the servlet engine?

It's best not to be storing user specific state in a servlet in the first place as multiple users will access it. There could be state that applies to everyone - such as a data access object reference. In this case, you would want the data to be be serializable if your server implements hibernation.

I don't see the value of duplicating the servlet. The server could just create a new one.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why do genericServlet and HttpServlet implements serizable inferface
 
Similar Threads
need advice
Why HttpServlet implements Serializable interface
init missing in servlet
types of servlets
Why both GenericServlet and HttpServlet implements Serializable interface ?