final String baseUriProperty = prefix + "baseUri";
final Object bu = serverConfig.getProperty(baseUriProperty);
final String customBaseUri = (bu != null) ? bu.toString() : binding.baseUri();
final String configClassProperty = prefix + "configClass";
final ClientConfig cfg = resolveConfig(configClassProperty, binding);
final String inheritProvidersProperty = prefix + "inheritServerProviders";
if (PropertiesHelper.isProperty(serverConfig.getProperty(inheritProvidersProperty)) ||
binding.inheritProviders()) {
copyProviders(serverConfig, cfg);
}
final String propertyPrefix = prefix + "property.";
Collection<String> clientProperties =
Collections2.filter(serverConfig.getPropertyNames(), new Predicate<String>() {
@Override
public boolean apply(String property) {
return property.startsWith(propertyPrefix);
}
});
for (String property : clientProperties) {
cfg.property(property.substring(propertyPrefix.length()),
serverConfig.getProperty(property));
}
return new ManagedClient(ClientBuilder.newClient(cfg), customBaseUri);
}