• Post Reply Bookmark Topic Watch Topic
  • New Topic

size of the object in session  RSS feed

 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this correct to find out the size of the object in session ??am i doing wrong?

i am using HttpSessionAttributeListener interface to get size of the object in session.


private int getAttributeSize(HttpSessionBindingEvent sbe) {
try {
ByteArrayOutputStream bao= new ByteArrayOutputStream();
BufferedOutputStream bos= new BufferedOutputStream(bao);
ObjectOutputStream oos= new ObjectOutputStream(bos);


String attributeName= sbe.getName();
oos.writeObject(sbe.getSession().getAttribute(attributeName));
oos.flush();

int size = bao.size();
return size;
}catch(Exception exp){
return 0;
}
}
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is already a conversation here.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!