You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Khalid K." <gr...@maikada.com> on 2004/01/22 05:01:16 UTC

HttpSession size - is this code correct?

Hi,

I am trying to dertemine the size of the session object, 
I've looked around and have written the following, please let me if this
is correct.

	Enumeration e = session.getAttributeNames();
	ByteArrayOutputStream  bos = new ByteArrayOutputStream();
	ObjectOutputStream s = new ObjectOutputStream(bos);

	while (e.hasMoreElements()) {
		Object o = session.getAttribute((String)
e.nextElement());		
		s.writeObject(o);
		s.flush();
	}
	System.err.println("size = " + bos.size());

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004
 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org