0

How To Access org.zkoss.zss.ui.Spreadsheet From HttpServletRequest?

asked 2012-10-09 16:01:58 +0800

phlogistic gravatar image phlogistic
18

Hi, I'd like to access the org.zkoss.zss.ui.Spreadsheet object from a servlet filter.

Purpose for doing this is to create a quasi-timeout; after 5 minutes of inactivity, take that spreadsheet, and serialize it disk. That way memory is freed up in the heap for the VM, as the Spreadsheet object is large in heap.

Then when a user does something with the spreadsheet in a window beyond 5 minutes to the session timeout defined in web.xml, re-load that spreadsheet from disk. Yes I'm aware there will be performance implications on the reload, but I'm trying to keep the amount of heap down for loaded spreadsheets.

Anyways, any way to access a org.zkoss.zss.ui.Spreadsheet type object from HttpServletRequest?

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-10-15 04:30:25 +0800

samchuang gravatar image samchuang
4084 4

Hi, phlogistic

Can you save the Spreadsheet in http session ? and access from session in Filter ?

link publish delete flag offensive edit

answered 2012-10-15 16:39:05 +0800

phlogistic gravatar image phlogistic
18

How do I save the spreadsheet in session?

Is there a setting in

http://www.zkoss.org/javadoc/latest/zss/org/zkoss/zss/ui/Spreadsheet.html

Or the <spreadsheet> element?

link publish delete flag offensive edit

answered 2012-10-17 09:30:36 +0800

samchuang gravatar image samchuang
4084 4

Hi, phlogistic

on second thought, it seems that store spreadsheet component on session is not a good idea.

component stay on desktop scope, if save component to session, what if desktop get cleanup, the spreadsheet instance will not get cleanup, because session still alive.

so, I am think about another way, maybe using some cache system (for example Commons JCS, Ehcache etc...) to cache the spreadsheet component. and restore from it, it's just a idea, not sure how to implement it

link publish delete flag offensive edit

answered 2012-10-18 06:48:49 +0800

samchuang gravatar image samchuang
4084 4

Hi, phlogistic

after I discuss with my colleague, he mentioned another possible approach by using encache

1. use a timer on zul page, timer will send event to server after 3 min when user doesn't do anything at client, when server receive this event, AP will detach spreadshet from desktop, and put the spreadsheet to encache. The mask can be a div or borderlayout that has a label says "spreadsheet is idle or sleeping", and the mask has a button that will "wake spreadsheet", when user click the button, AP will need to get spreadsheet from encache and attache to desktop, replace the mask

2. how do we determinate that user does't do anything ? possible way is using client side programming or use piggyback event.
-> if use client side programming: override zk event fire API, when event occure, means user is doing something, so we can reset the timer at client

-> if use piggyback, when zk fire event to server, the piggyback will go with it, then it means user is doing something, server will maintain a timestamp; If user doesn't do anything, then after 3 min, zk will fire onTimer and piggyback event to server, then AP check the timestamp, if more then 3 min, then means user doesn't do anything

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-10-09 16:01:58 +0800

Seen: 150 times

Last updated: Oct 18 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More