David Navas wrote:
> If releasePageContext() is called against the factory, that means that the
> writer of the JSP page can't write their own cleanup routines. From a server
> provider perspective, clearly, we can. But that makes extended tags which
> export info that have their own cleanup requirements kind of difficult to
> create, yes?
>
> Or do users get to specify the JspFactory?
No, JSP authors do not get to specify the JSPFactory; imagine the security risks if
they
could...
Specifically, JspFactory.setDefaultFactory in the javadoc states: "It is illegal for
any
principal
other than the JSP Engine runtime to call this method."
However, releasePageContext is not designed to be over-ridden. Generally, its
implementation
should go through its hashtable which stores page-scope objects and null it out.
What you could do in cleaning up custom tags is to wrap any allocated resource in bean
and give
it (the default) page scope. When the page goes out of scope, releasePageContext is
automatically
called and the sole reference to the bean should be nulled out. Eventually, the
garbage
collector will
call the bean's finalize method, where you can deallocate your resources as needed.
If you need the tag's resources to be deallocated immediately when the page goes out
of scope,
either
your JSP implementation engine must call finalize on each object of its page-hashtable
before
nulling them
out (JSP authors have no control over this), or you can write a scriptlet at the end
of your
page to do this
manually.
Although it is not specifically stated in the specs, a sensible releasePageContext
implementation would
call finalize on all the page scope objects and null out their references in the
hashtable. If
this is really
important to you for the specs to state this explicitly, email the JSP spec writers at:
[EMAIL PROTECTED]
--
Michael Hu, Paradox Team, Corel Corporation
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html