213.7. Samples
在上面的 Spring 配置后,以下代码示例发送一个 LDAP 请求,以过滤成员的搜索组。然后,从响应中提取通用名称。
ProducerTemplate<Exchange> template = exchange.getContext().createProducerTemplate();
List<?> results = (Collection<?>) template.sendBody("ldap:ldapConnection, "LDiff goes here");
if (results.size() > 0) {
// Check for no errors
for (String result : results) {
if ("success".equalTo(result)) {
// LDIF entry success
} else {
// LDIF entry failure
}
}
}