// only set a new toolbox if we need one
if (toolboxFactory.hasTools(Scope.REQUEST)
&& request.getAttribute(this.toolboxKey) == null)
{
// add request toolbox, if any
Toolbox reqTools = toolboxFactory.createToolbox(Scope.REQUEST);
if (reqTools != null)
{
request.setAttribute(this.toolboxKey, reqTools);
}
}
//TODO: move this string constant somewhere static
if (toolboxFactory.hasTools(Scope.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(Scope.SESSION);
session.setAttribute(this.toolboxKey, sessTools);
}
}
}