@Override protected void bindErrorHandlers() { bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(CloudStackErrorHandler.class); bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(CloudStackErrorHandler.class); bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(CloudStackErrorHandler.class); }
@Override protected void configure() { bind(new TypeLiteral<ApiContext<CloudStackDomainApi>>() { }).to(new TypeLiteral<ApiContextImpl<CloudStackDomainApi>>() { }); bind(new TypeLiteral<ApiContext<CloudStackGlobalApi>>() { }).to(new TypeLiteral<ApiContextImpl<CloudStackGlobalApi>>() { }); bind(CredentialType.class).toProvider(CredentialTypeFromPropertyOrDefault.class); // session client is used directly for filters and retry handlers, so let's bind it explicitly bindHttpApi(binder(), SessionApi.class); bindHttpApi(binder(), CloudStackDomainApi.class); bindHttpApi(binder(), CloudStackGlobalApi.class); bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class); super.configure(); }
@Override protected void installLocations() { super.installLocations(); bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON); }