public class IlvChartSessionAttribute extends IlvComponentSessionAttribute
IlvChartSessionAttribute class acts as a proxy for an
IlvChart bound to an HttpSession. When you bind
a chart as an attribute of an HttpSession,
proper cleanup of the chart must occur when the session is invalidated or
expires. This allows the chart to be garbage collected or restored to a pool of available
charts, depending on your choice of strategies. Instead of binding the
chart directly to the session, use an instance of this class as a proxy:
When all the sessions that the proxy and its component are associated with expire, theIlvChart chart = null; HttpSession session = request.getSession(); if (session.isNew()) { chart = ... create new chart or fetch from pool ... IlvChartSessionAttribute proxy = new IlvChartSessionAttribute(chart); session.setAttribute(CHART_KEY, proxy); } else { IlvChartSessionAttribute proxy = (IlvChartSessionAttribute)session.getAttribute(CHART_KEY); if (proxy != null) chart = proxy.getChart(); } if (chart == null) throw new ServletException("session problem");
componentUnbound() method of the proxy will be invoked.
You can override this method to customize your strategy for handling charts
that are no longer associated with any sessions.| Constructor and Description |
|---|
IlvChartSessionAttribute(IlvChart chart)
Creates an
IlvChartSessionAttribute proxy for the
specified chart. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
componentUnbound()
This method is automatically invoked when the proxy is unbound from its
last HTTP session.
|
IlvChart |
getChart()
Returns the proxy chart.
|
getComponent, valueBound, valueUnboundpublic IlvChartSessionAttribute(IlvChart chart)
IlvChartSessionAttribute proxy for the
specified chart.chart - The chart.public IlvChart getChart()
protected void componentUnbound()
componentUnbound in class IlvComponentSessionAttribute© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.