ComponentMonitor monitor = new AttributeSetterComponentMonitor(new AttributeSetterComponentMonitor.AttributeSetter() {
public void setAttribute(String name, Object object) {
request.getRequest().setAttribute(name, object);
}
});
MutablePicoContainer requestContainer = new DefaultPicoContainer(new Caching(),
new JavaEE5LifecycleStrategy(monitor), parentContainer, monitor);
requestContainer.addComponent(HttpSession.class, request.getRequest().getSession());
for (Map.Entry<Class<?>, Class<?>> entry : requestScoped.entrySet()) {
requestContainer.addComponent(entry.getKey(), entry.getValue());
}
for (Map.Entry<Class<?>, Class<?>> entry : prototypeScoped.entrySet()) {
requestContainer.as(Characteristics.NO_CACHE).addComponent(entry.getKey(), entry.getValue());
}
requestContainer.addComponent(request).addComponent(request.getRequest()).addComponent(request.getResponse());
registerComponentFactories(requestContainer, componentFactoryRegistry.getRequestMap());
return new PicoBasedContainer(requestContainer);
}