// only set a new toolbox if we need one
if (toolboxFactory.hasTools(ToolboxFactory.DEFAULT_SCOPE)
&& request.getAttribute(this.toolboxKey) == null)
{
// add request toolbox, if any
Toolbox reqTools =
toolboxFactory.createToolbox(ToolboxFactory.DEFAULT_SCOPE);
if (reqTools != null)
{
request.setAttribute(this.toolboxKey, reqTools);
}
}
//TODO: move this string constant somewhere static
if (toolboxFactory.hasTools("session"))
{
//FIXME? does this honor createSession props set on the session Toolbox?
HttpSession session = request.getSession(this.createSession);
if (session != null)
{
// allow only one thread per session at a time
synchronized(getMutex(session))
{
if (session.getAttribute(this.toolboxKey) == null)
{
Toolbox sessTools =
toolboxFactory.createToolbox("session");
session.setAttribute(this.toolboxKey, sessTools);
}
}
}