Exemplo n.º 1
0
  @Override
  protected void configure() {
    install(
        new RequestScope.Binder(), // must go first as it registers the request scope instance.
        new JerseyErrorService.Binder(),
        new ContextInjectionResolver.Binder(),
        new JerseyClassAnalyzer.Binder(),
        new MessagingBinders.MessageBodyProviders(applicationProperties, RuntimeType.CLIENT),
        new MessagingBinders.HeaderDelegateProviders(),
        new MessageBodyFactory.Binder(),
        new ContextResolverFactory.Binder(),
        new JaxrsProviders.Binder(),
        new ServiceFinderBinder<AutoDiscoverable>(
            AutoDiscoverable.class, applicationProperties, RuntimeType.CLIENT));

    bindFactory(ReferencingFactory.<ClientConfig>referenceFactory())
        .to(new TypeLiteral<Ref<ClientConfig>>() {})
        .in(RequestScoped.class);

    bindFactory(RequestContextInjectionFactory.class)
        .to(ClientRequest.class)
        .in(RequestScoped.class);

    bindFactory(ReferencingFactory.<ClientRequest>referenceFactory())
        .to(new TypeLiteral<Ref<ClientRequest>>() {})
        .in(RequestScoped.class);

    bindFactory(PropertiesDelegateFactory.class, Singleton.class)
        .to(PropertiesDelegate.class)
        .in(RequestScoped.class);

    // ChunkedInput entity support
    bind(ChunkedInputReader.class).to(MessageBodyReader.class).in(Singleton.class);
  }
    @Override
    protected void configure() {

      bindFactory(ProcessingProvidersReferencingFactory.class)
          .to(ProcessingProviders.class)
          .in(PerLookup.class);
      bindFactory(ReferencingFactory.<ProcessingProviders>referenceFactory())
          .to(new TypeLiteral<Ref<ProcessingProviders>>() {})
          .in(Singleton.class);
    }
Exemplo n.º 3
0
  @Override
  protected void configure() {
    install(
        new RequestScope.Binder(), // must go first as it registers the request scope instance.
        new ContextInjectionResolver.Binder(),
        new MessagingBinders.MessageBodyProviders(),
        new MessagingBinders.HeaderDelegateProviders(),
        new MessageBodyFactory.Binder(),
        new ContextResolverFactory.Binder(),
        new JaxrsProviders.Binder(),
        new ExceptionWrapperInterceptor.Binder());

    bindFactory(ReferencingFactory.<ClientConfig>referenceFactory())
        .to(new TypeLiteral<Ref<ClientConfig>>() {})
        .in(RequestScoped.class);

    bindFactory(RequestContextInjectionFactory.class)
        .to(ClientRequest.class)
        .in(RequestScoped.class);

    bindFactory(ReferencingFactory.<ClientRequest>referenceFactory())
        .to(new TypeLiteral<Ref<ClientRequest>>() {})
        .in(RequestScoped.class);
  }
Exemplo n.º 4
0
  @Override
  protected void configure() {
    install(
        new RequestScope.Module(), // must go first as it registers the request scope instance.
        new ProcessingModule(),
        new ContextInjectionResolver.Module(),
        new MessagingModules.MessageBodyProviders(),
        new ServiceProvidersModule(RequestScope.class),
        new MessageBodyFactory.Module(RequestScope.class),
        new ExceptionMapperFactory.Module(RequestScope.class),
        new ContextResolverFactory.Module(RequestScope.class),
        new JaxrsProviders.Module(),
        new FilterModule(),
        new ExceptionWrapperInterceptor.Module());

    // Request/Response staging contexts
    bind(new TypeLiteral<StagingContext<Request>>() {})
        .to(new TypeLiteral<DefaultStagingContext<Request>>() {})
        .in(RequestScope.class);

    bind(new TypeLiteral<StagingContext<Response>>() {})
        .to(new TypeLiteral<DefaultStagingContext<Response>>() {})
        .in(RequestScope.class);

    // Request processor
    bind(LinearAcceptor.class).annotatedWith(Stage.Root.class).toFactory(rootAcceptorFactory);

    bind(RequestProcessor.class).to(LinearRequestProcessor.class);
    // Request invoker
    bind(RespondingContext.class).to(DefaultRespondingContext.class).in(RequestScope.class);

    bind().to(ResponseProcessor.Builder.class);

    bind().to(RequestInvoker.class);

    bind(javax.ws.rs.client.Configuration.class)
        .toFactory(ConfigurationInjectionFactory.class)
        .in(RequestScope.class);
    bind(FeaturesAndProperties.class)
        .toFactory(ConfigurationInjectionFactory.class)
        .in(RequestScope.class);
    bind(new TypeLiteral<Ref<JerseyConfiguration>>() {})
        .toFactory(ReferencingFactory.<JerseyConfiguration>referenceFactory())
        .in(RequestScope.class);
  }