*/
@SuppressWarnings("rawtypes")
protected void processInjector(ServletContext context, Injector inj) {
final Registry registry = (Registry) context
.getAttribute(Registry.class.getName());
final ResteasyProviderFactory providerFactory = (ResteasyProviderFactory) context
.getAttribute(ResteasyProviderFactory.class.getName());
for (final Binding<?> binding : inj.getBindings().values()) {
final Type type = binding.getKey().getTypeLiteral().getType();
if (type instanceof Class) {
final Class<?> beanClass = (Class) type;
if (GetRestful.isRootResource(beanClass)) {
final ResourceFactory resourceFactory = new GuiceResourceFactory(
binding.getProvider(), beanClass);
log.info("Registering factory for {}", beanClass.getName());
registry.addResourceFactory(resourceFactory);
}
if (beanClass.isAnnotationPresent(Provider.class)) {
log.info("Registering provider instance for {}", beanClass.getName());
providerFactory.registerProviderInstance(binding
.getProvider().get());
}
}
}
}