use of org.jboss.resteasy.reactive.client.spi.ClientContext in project quarkus by quarkusio.
the class RestClientsContainer method getClientData.
/**
* Used in Dev UI
*
* @return info about exposed clients
*/
public RestClientData getClientData() {
ClientContext context = CLIENT_CONTEXT_RESOLVER.resolve(Thread.currentThread().getContextClassLoader());
ClientProxies.ClientData clientData = context.getClientProxies().getClientData();
List<RestClientInfo> restClients = new ArrayList<>();
List<PossibleRestClientInfo> possibleRestClients = new ArrayList<>();
for (Class<?> clientClass : clientData.clientClasses) {
Instance<?> select = injectableClients.select(clientClass);
String interfaceName = clientClass.getName();
if (select.isResolvable()) {
String configKey = RestClientRecorder.getConfigKeys().get(interfaceName);
if (configKey == null) {
configKey = String.format("\"%s\"", interfaceName);
}
restClients.add(new RestClientInfo(interfaceName, true, configKey));
} else {
restClients.add(new RestClientInfo(interfaceName, false, null));
}
}
restClients.sort(Comparator.comparing(info -> info.interfaceClass));
for (Map.Entry<Class<?>, String> clientEntry : clientData.failures.entrySet()) {
possibleRestClients.add(new PossibleRestClientInfo(clientEntry.getKey().getName(), clientEntry.getValue()));
}
possibleRestClients.sort(Comparator.comparing(info -> info.interfaceClass));
return new RestClientData(restClients, possibleRestClients);
}
Aggregations