本文整理匯總了Java中com.unboundid.ldap.sdk.Control類的典型用法代碼示例。如果您正苦於以下問題:Java Control類的具體用法?Java Control怎麽用?Java Control使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Control類屬於com.unboundid.ldap.sdk包,在下文中一共展示了Control類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: scrollSimplePagedResultsControl
import com.unboundid.ldap.sdk.Control; //導入依賴的package包/類
private ASN1OctetString scrollSimplePagedResultsControl(LDAPConnection ldapConnection, String dn, Filter filter, SearchScope scope, Control[] controls, int startIndex) throws LDAPException, InvalidSimplePageControlException {
SearchRequest searchRequest = new SearchRequest(dn, scope, filter, "dn");
int currentStartIndex = startIndex;
ASN1OctetString cookie = null;
do {
int pageSize = Math.min(currentStartIndex, 100);
searchRequest.setControls(new Control[]{new SimplePagedResultsControl(pageSize, cookie, true)});
setControls(searchRequest, controls);
SearchResult searchResult = ldapConnection.search(searchRequest);
currentStartIndex -= searchResult.getEntryCount();
try {
SimplePagedResultsControl c = SimplePagedResultsControl.get(searchResult);
if (c != null) {
cookie = c.getCookie();
}
} catch (LDAPException ex) {
log.error("Error while accessing cookie", ex);
throw new InvalidSimplePageControlException(ex.getResultCode(), "Error while accessing cookie");
}
} while ((cookie != null) && (cookie.getValueLength() > 0) && (currentStartIndex > 0));
return cookie;
}
示例2: setControls
import com.unboundid.ldap.sdk.Control; //導入依賴的package包/類
private void setControls(SearchRequest searchRequest, Control... controls) {
if (!ArrayHelper.isEmpty(controls)) {
Control[] newControls;
if (ArrayHelper.isEmpty(searchRequest.getControls())) {
newControls = controls;
} else {
newControls = ArrayHelper.arrayMerge(searchRequest.getControls(), controls);
}
searchRequest.setControls(newControls);
}
}
示例3: search
import com.unboundid.ldap.sdk.Control; //導入依賴的package包/類
SearchResult search(String dn, Filter filter, int searchLimit, int sizeLimit, Control[] controls,
String... attributes) throws SearchException;
示例4: search
import com.unboundid.ldap.sdk.Control; //導入依賴的package包/類
@Override
public SearchResult search(String dn, Filter filter, int searchLimit, int sizeLimit, Control[] controls, String... attributes)
throws SearchException {
return search(dn, filter, SearchScope.SUB, searchLimit, sizeLimit, controls, attributes);
}