201.6. サンプル
上記の Spring 設定から、以下のコードサンプルは、グループでメンバーを検索するための LDAP リクエストを送信します。その後、Common Name が応答から抽出されます。
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 } } }
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
}
}
}