/** Creates a factory with a list of default handlers. */ public DefaultRequestHandlerFactory() { List<RequestHandlerProvider> requestHandlerProviders = Collections.emptyList(); try { requestHandlerProviders = ProviderFinder.of(RequestHandlerProvider.class).find(); } catch (final NoClassDefFoundError e) { } final List<RequestHandler> requestHandlers = new ArrayList<RequestHandler>(); for (final RequestHandlerProvider provider : requestHandlerProviders) { LOG.debug("using provider: {}", provider); requestHandlers.addAll(provider.provideRequestHandlers().values()); } setHandlers(requestHandlers); }
/** * @return the {@link ProviderFinder} used to find all strategies. @VisibleForTesting This method * is not final only for testing purposes. */ protected ProviderFinder<P> getProviderFinder() { if (providerFinder == null) { providerFinder = ProviderFinder.of(getProviderClass()); } return providerFinder; }