HttpServletRequest request,
ServletContext application)
{
String path = getPath(request);
Toolbox toolbox = (Toolbox)request.getAttribute(toolboxKey);
if (toolbox != null)
{
Object tool = toolbox.get(key, path);
if (tool != null)
{
return tool;
}
}
HttpSession session = request.getSession(false);
if (session != null)
{
toolbox = (Toolbox)session.getAttribute(toolboxKey);
if (toolbox != null)
{
Object tool = toolbox.get(key, path);
if (tool != null)
{
return tool;
}
}
if (application == null)
{
application = session.getServletContext();
}
}
if (application != null)
{
toolbox = (Toolbox)application.getAttribute(toolboxKey);
if (toolbox != null)
{
return toolbox.get(key, path);
}
}
return null;
}