![](/img/trans.png)
[英]java- how to tell LDAP DirContext.search(…).hasMore() to return false instead of throwing a PartialResultException
[英]how to specify search scope and returning attributes together for ldap DirContext.search(…)
我有一種情況,我必須使用DirContext搜索API返回ldap搜索的屬性。 原因是我要獲取的屬性是“操作屬性”,如果我沒有在搜索命令中專門設置屬性名稱,它將不會返回。
誰能告訴我如何指定搜索范圍並同時返回屬性?
我看不到有任何API允許我這樣做。 它們要么允許我指定SearchControls,要么指定attributeToReturn,但不能同時指定兩者。
search(Name name, Attributes matchingAttributes)
search(Name name, Attributes matchingAttributes, String[] attributesToReturn)
search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons)
search(Name name, String filter, SearchControls cons)
search(String name, Attributes matchingAttributes)
search(String name, Attributes matchingAttributes, String[] attributesToReturn)
search(String name, String filterExpr, Object[] filterArgs, SearchControls cons)
search(String name, String filter, SearchControls cons)
當然不能。 您需要使用帶有“ SearchControls”參數的其他重載之一。
編輯:
誰能告訴我如何指定搜索范圍並同時返回屬性?
要返回的屬性是SearchControls.
的屬性SearchControls.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.