LDAP不适用于JBoss 5.x,而JBoss 4.x则适用

时间:2012-07-05 19:39:15

标签: jboss ldap

我们正在尝试在Jboss 5.1上运行LDAP java程序,并且身份验证失败。这个应用程序在Jboss 4.3下运行,从命令行通过JVM运行。

基本上,代码中填充了一个cookie。它不适用于Jboss 5.1。

他们正在使用JDK 1.6.0_27。

以下是用于LDAP的代码段。

为什么只有JBoss 5.x的PagedResultsResponseControl getCookie为NULL?该部门有什么变化吗?

        do { 
            NamingEnumeration results = ctx.search("ou=people,ou=appname,dc=dept,dc=test,dc=com", 
                    "(&(objectclass=user)(CN=*))", new SearchControls()); 
            Control[] controls = ctx.getResponseControls(); 
            if (controls != null) 
            { 
                System.out.println("if (controls != null) controls.length=" + controls.length); 
                for (int i = 0; i < controls.length; i++) 
                { 
                    if (controls[i] instanceof PagedResultsResponseControl) 
                    { 
                        PagedResultsResponseControl prrc = (PagedResultsResponseControl)controls[i]; 
                        cookie = prrc.getCookie(); /// The cookie is returned as null when run on jboss 5.1. It returns a cookie containg details of next page to be retrieved. 
                                                   // This part of the code works perfectly fine with jboss 4.3 and command line. 
                    } 
                } 
            } 
            else 
            { 
                System.out.println("No controls were sent from the server"); 
            } 
            // Re-activate paged results 
            ctx.setRequestControls(new Control[]{ 
                    new PagedResultsControl(pageSize, cookie, Control.CRITICAL) }); 

            if(cookie==null) 
            { 
                System.out.println("cookie is null"); 
            } 
            else 
            { 
                System.out.println("cookie.length= " + cookie.length + "cookie= " + cookie.toString()); 
            } 

        } while (cookie != null); 

0 个答案:

没有答案