212.7. 샘플

위의 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
    }
  }
}