*
* @param scope the named context scope to put the attributes into.
*/
public void importAttributes(String scope)
{
ComponentContext context = getCurrentContext();
Iterator names = context.getAttributeNames();
if (scope.equals(PAGE_SCOPE))
{
while (names.hasNext())
{
String name = (String)names.next();
velocityContext.put(name, context.getAttribute(name));
}
}
else if (scope.equals(REQUEST_SCOPE))
{
while (names.hasNext())
{
String name = (String)names.next();
request.setAttribute(name, context.getAttribute(name));
}
}
else if (scope.equals(SESSION_SCOPE))
{
HttpSession session = request.getSession();
while (names.hasNext())
{
String name = (String)names.next();
session.setAttribute(name, context.getAttribute(name));
}
}
else if (scope.equals(APPLICATION_SCOPE))
{
while (names.hasNext())
{
String name = (String)names.next();
application.setAttribute(name, context.getAttribute(name));
}
}
}