Here is an example to the classes I have to bind. Some I can just
bind, the others need a provider method because juice requires an
annotation. It would be helpful if there is a guice module that is
part of the integration that has all the binding and factory methods.
Will save me a lot of work, and users can subclass it. As it is now,
it looks like it is not possible because some classes require a
runtime instance like RequestInfo as part of the injection process, at
least the way guice is doing it.
public class VraptorModule extends ServletModule {
@Override
protected void configureServlets() {
bind(EncodingHandler.class).toInstance(new
WebXmlEncodingHandler("UTF-8"));
bind(Container.class).to(GuiceContainer.class).in(Singleton.class);
}
@Provides
@Singleton
InterceptorHandlerFactory createInterceptorHandlerFactory(Container
container){
return new DefaultInterceptorHandlerFactory(container);
}
@Provides
InterceptorStack createInterceptorStack(InterceptorHandlerFactory
factory){
return new DefaultInterceptorStack(factory);
}
@Provides
@RequestScoped
RequestExecution createRequestExecution(InterceptorStack stack){
return new GuiceRequestExecution(stack);
}
@Provides
ResourceLookupInterceptor
craeteResourceLookupInterceptor(UrlToResourceTranslator translator,
MethodInfo methodInfo,
ResourceNotFoundHandler resourceNotFoundHandler,
MethodNotAllowedHandler methodNotAllowedHandler,
RequestInfo requestInfo){
return new ResourceLookupInterceptor(translator, methodInfo,
resourceNotFoundHandler, methodNotAllowedHandler, requestInfo);
}
...