亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
12下一頁
最近訪問板塊 發(fā)新帖
查看: 13014 | 回復(fù): 11
打印 上一主題 下一主題

[ldap] 有人在這里討論一下,javax.naming.ldap.PagedResultsControl ,ldap分頁的問題嗎? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2006-11-06 16:20 |只看該作者 |倒序?yàn)g覽
sun的jndi中提供的分頁功能javax.naming.ldap.PagedResultsControl ,好像用起來不太爽,不知道大家怎么處理的,
比如,我是在b/s模式中進(jìn)行分頁,可能是我理解的錯(cuò)誤,這個(gè)接口的分頁好像是從一個(gè)上一個(gè)查詢中返回的結(jié)果中取得cookie才能翻到下一頁,但是在b/s模式中,從第一頁直接翻到第N頁,哪不是要先得到N-1個(gè)cookie??這樣每次從頭翻到尾還有什么意義呢? 哪位仁兄,達(dá)人,可以切磋一下?

[ 本帖最后由 wangbaohua 于 2007-1-23 19:01 編輯 ]

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2006-11-06 16:37 |只看該作者
自己先頂一個(gè),目前好像目錄的分頁功能并不是所有的服務(wù)器都技持,
大家知道技持分頁功能的目錄服務(wù)有哪些??

雖然同為sun自己的東西,netscape.ldap.controls.LDAPVirtualListControl,跟他自己標(biāo)準(zhǔn)的
javax.naming.ldap.PagedResultsControl 用法好像就完全不一樣,前者只要用
LDAPVirtualListControl(int startIndex, int beforeCount, int afterCount, int contentCount)
就可以了,

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2006-11-06 17:24 |只看該作者
關(guān)注!!

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2006-11-06 17:35 |只看該作者
http://www3.ietf.org/proceedings ... t-ldapv3-vlv-09.txt,
       LDAP Extensions for Scrolling View Browsing of Search Results
http://www.ietf.org/rfc/rfc2696.txt,
     LDAP Control Extension for Simple Paged Results Manipulation

顯然這兩個(gè)東西是不一樣的,前一個(gè)簡(jiǎn)稱vlv,這樣來看sun的標(biāo)準(zhǔn)接口對(duì)于開發(fā)來說提供的支持還不是很全面,我想各個(gè)目錄服務(wù)自己提供的sdk應(yīng)該都有類似這樣功能的實(shí)現(xiàn)吧! 比較了一下,實(shí)現(xiàn)了vlv的接口可能在功能上更好用, 但是sun提供的提接口從方向上來說,更可能是一種標(biāo)準(zhǔn),只是不知道他們什么時(shí)候提供vlv功能。

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2006-11-06 18:16 |只看該作者
下載了所有的jndi的擴(kuò)展包下來,一個(gè)一個(gè)看過,終于發(fā)現(xiàn)sun的vlv接口在ldapbp-1_0.zip(LDAP Booster Pack 1.0 Release)中

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2006-11-08 09:16 |只看該作者
做一個(gè)分頁的例子,運(yùn)行成功,但是速度是非常的慢,我在50000條數(shù)據(jù)中做分頁,每頁大小才20,
但是每查詢一次好像要48875ms,基本上屬于不可用的狀態(tài)。

服務(wù)器環(huán)境是sun one directory server 5.2 ,win2003,

暫時(shí)不知道是什么原因,導(dǎo)致慢,因?yàn)榫退阄野?0000條記錄全部輸出花的時(shí)間也只有這個(gè)時(shí)間的零頭。
有人懂這個(gè)原理的么??

import javax.naming.*;
import javax.naming.directory.*;
import javax.naming.ldap.*;
import java.io.IOException;
import java.util.*;
import com.sun.jndi.ldap.ctl.*;

public class PageMain {

        public static void main(String[] args) {


                Hashtable m_env = new Hashtable(5, 0.75f);
                LdapContext m_Ctx;
                m_env.put(Context.INITIAL_CONTEXT_FACTORY,
                                "com.sun.jndi.ldap.LdapCtxFactory");
                m_env.put("java.naming.ldap.version", "3");
                m_env.put(Context.PROVIDER_URL, "ldap://192.168.1.153:12345");
                m_env.put(Context.SECURITY_AUTHENTICATION, "simple");
                m_env.put(Context.SECURITY_PRINCIPAL, "cn=Directory Manager");
                m_env.put(Context.SECURITY_CREDENTIALS,"12345678");

                try{
                        m_Ctx = new InitialLdapContext(m_env, null);
                        boolean b = true;
                        int counter = 0;
                        int listSize = 0;
                        int i = 0;
                        int nTargetOffset = 1;
                        int nPageSize = 20;
                        while (b) {
                               
                                VirtualListViewControl vctl
                                = new VirtualListViewControl(nTargetOffset, 0, 0, nPageSize, Control.CRITICAL);
                                javax.naming.ldap.SortControl sctl
                                =new javax.naming.ldap.SortControl(new String[] { "cn" },Control.CRITICAL);
                               
                                m_Ctx.setRequestControls(new Control[] { sctl, vctl });

                                SearchControls constraints = new SearchControls();
                                constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
                                String[] retAtt = { "cn" };
                                constraints.setReturningAttributes(retAtt);
                               
                                String searchCondition = "(objectclass=inetOrgPerson)";
                               
                                System.out.println("-----------"+i+"-----------");

                                i++;
                                NamingEnumeration results =
                                        m_Ctx.search("dc=com", searchCondition,constraints);
                                System.out.println(m_Ctx);
                                int subcounter = 0;
                                if (results != null) {
                                        System.out.println("---------println results-----------");
                                        while (results.hasMoreElements()) {
                                                subcounter++;
                                                SearchResult si = (SearchResult) results.nextElement();
                                                counter++;
                                                System.out.println(si.getName());
                                        }
                                        System.out.println(searchCondition + " returned "+ subcounter);
                                        if (subcounter == 0){
                                                b = false;
                                                }
                                } else{
                                        System.out.println(searchCondition+ " did not match with any!!!");
                                }

                                System.out.println("------------------NEW PAGE NO. " + i);
                                nTargetOffset += subcounter; // nPageSize; //subcounter;
                        }
               
                } catch (NamingException e) {
                        e.printStackTrace();
                        System.out.println(e);
                }catch (IOException ex) {
                        System.out.print(ex);
                }
               
        }

}

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2006-11-08 10:26 |只看該作者
上面同樣的分頁功能在 openldap 2.2.*中,執(zhí)行不能成功,
報(bào)錯(cuò):
javax.naming.OperationNotSupportedException: [LDAP: error code 12 - critical extension is not recognized]; remaining name ……
我沒有看到openldap說支持vlv,是不是它就不支持。

論壇徽章:
0
8 [報(bào)告]
發(fā)表于 2006-11-10 17:54 |只看該作者
終于采用在 netscape.ldap 的sdk中提供的vlv方法分頁成功,速度還不錯(cuò),

只是留下幾個(gè)疑問,如果把jndi比作jdbc,哪么看來各個(gè)目錄對(duì)jndi的支持還不夠,

包括sun自己。如果真要做什么開發(fā)如果不用jndi可能使程序失去復(fù)用性。

目前我在做一個(gè)目錄的應(yīng)用,在選擇目錄服務(wù)器上,和采用的開發(fā)接口上,正在猶豫中……

現(xiàn)在我的基本想法,就是基本netscape 和它自己的sdk來做,因?yàn)槲也皇亲霎a(chǎn)品,

專用也就專用了,我現(xiàn)在想做一些基本的封裝,把邏輯層和目錄操作區(qū)分一下。

也試過spring的ldap,沒多看,基為它是基于jndi的所以還是不太放心,

   另:第一次發(fā)帖,發(fā)現(xiàn)好像自言自語,好不凄涼……,希望對(duì)大家有些幫助

論壇徽章:
0
9 [報(bào)告]
發(fā)表于 2007-02-06 19:35 |只看該作者

回復(fù) 8樓 wangbaohua 的帖子

我也有同感,之前寫了一個(gè)spring ldap分頁的測(cè)試用例,可是怎么都跑不起來,郁悶。
現(xiàn)將代碼貼出來,請(qǐng)大俠指點(diǎn)一下:
package com.cvicse.sso.console.dao;

import javax.naming.directory.SearchControls;

import junit.framework.TestCase;

import org.springframework.ldap.CollectingNameClassPairCallbackHandler;
import org.springframework.ldap.support.control.PagedResultsCookie;
import org.springframework.ldap.support.control.PagedResultsRequestControl;

import com.cvicse.sso.console.dao.ldap.LdapTemplateExtend;
import com.cvicse.sso.console.dao.ldap.CAASUserAttributesMapper;

public class LdapTemplatePagedSearchITest extends TestCase {

        private LdapTemplateExtend tested;

        // LDAP contains 5 persons matching the filter. Page size is 3.
        // Expects two batches of 3 and 2 persons respectively.
        public void testPagedResult() {
                SearchControls searchControls = new SearchControls();
                searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                String base = "dc=cvicse,dc=com";
                String filter = "(&(objectclass=person)(cn=zhouzhou))";
                CAASUserAttributesMapper mapper = new CAASUserAttributesMapper();
                CollectingNameClassPairCallbackHandler handler = tested.new AttributesMapperCallbackHandler(
                                mapper);

                PagedResultsRequestControl requestControl;
                requestControl = new PagedResultsRequestControl(3);
                tested.search(base, filter, searchControls, handler, requestControl);
                PagedResultsCookie cookie = requestControl.getCookie();
                assertNotNull("Cookie should not be null yet", cookie.getCookie());
                assertEquals(3, handler.getList().size());

                // Prepare for second and last search
                requestControl = new PagedResultsRequestControl(3, cookie);
                tested.search(base, filter, searchControls, handler, requestControl);
                cookie = requestControl.getCookie();
                assertNull("Cookie should be null now", cookie.getCookie());
                assertEquals(5, handler.getList().size());
        }

}

論壇徽章:
0
10 [報(bào)告]
發(fā)表于 2007-02-27 09:39 |只看該作者
關(guān)注中.....
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP