<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.naming.ldap%2FPagedResultsResponseControl</id>
		<title>Java by API/javax.naming.ldap/PagedResultsResponseControl - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.naming.ldap%2FPagedResultsResponseControl"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_by_API/javax.naming.ldap/PagedResultsResponseControl&amp;action=history"/>
		<updated>2026-04-23T05:26:11Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_by_API/javax.naming.ldap/PagedResultsResponseControl&amp;diff=1691&amp;oldid=prev</id>
		<title> в 17:43, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_by_API/javax.naming.ldap/PagedResultsResponseControl&amp;diff=1691&amp;oldid=prev"/>
				<updated>2010-05-31T17:43:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 17:43, 31 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_by_API/javax.naming.ldap/PagedResultsResponseControl&amp;diff=1692&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_by_API/javax.naming.ldap/PagedResultsResponseControl&amp;diff=1692&amp;oldid=prev"/>
				<updated>2010-05-31T14:35:16Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== PagedResultsResponseControl: getResultSize() ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 1995 - 2008 Sun Microsystems, Inc.  All rights reserved.&lt;br /&gt;
 *&lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without&lt;br /&gt;
 * modification, are permitted provided that the following conditions&lt;br /&gt;
 * are met:&lt;br /&gt;
 *&lt;br /&gt;
 *   - Redistributions of source code must retain the above copyright&lt;br /&gt;
 *     notice, this list of conditions and the following disclaimer.&lt;br /&gt;
 *&lt;br /&gt;
 *   - Redistributions in binary form must reproduce the above copyright&lt;br /&gt;
 *     notice, this list of conditions and the following disclaimer in the&lt;br /&gt;
 *     documentation and/or other materials provided with the distribution.&lt;br /&gt;
 *&lt;br /&gt;
 *   - Neither the name of Sun Microsystems nor the names of its&lt;br /&gt;
 *     contributors may be used to endorse or promote products derived&lt;br /&gt;
 *     from this software without specific prior written permission.&lt;br /&gt;
 *&lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &amp;quot;AS&lt;br /&gt;
 * IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR&lt;br /&gt;
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 */&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.util.Hashtable;&lt;br /&gt;
import javax.naming.Context;&lt;br /&gt;
import javax.naming.NamingEnumeration;&lt;br /&gt;
import javax.naming.NamingException;&lt;br /&gt;
import javax.naming.directory.SearchControls;&lt;br /&gt;
import javax.naming.directory.SearchResult;&lt;br /&gt;
import javax.naming.ldap.Control;&lt;br /&gt;
import javax.naming.ldap.InitialLdapContext;&lt;br /&gt;
import javax.naming.ldap.LdapContext;&lt;br /&gt;
import javax.naming.ldap.PagedResultsControl;&lt;br /&gt;
import javax.naming.ldap.PagedResultsResponseControl;&lt;br /&gt;
/**&lt;br /&gt;
 * Shows how a paged search can be performed using the PagedResultsControl API&lt;br /&gt;
 */&lt;br /&gt;
class PagedSearch {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Hashtable&amp;lt;String, Object&amp;gt; env = new Hashtable&amp;lt;String, Object&amp;gt;(11);&lt;br /&gt;
    env&lt;br /&gt;
        .put(Context.INITIAL_CONTEXT_FACTORY,&lt;br /&gt;
            &amp;quot;com.sun.jndi.ldap.LdapCtxFactory&amp;quot;);&lt;br /&gt;
    /* Specify host and port to use for directory service */&lt;br /&gt;
    env.put(Context.PROVIDER_URL,&lt;br /&gt;
        &amp;quot;ldap://localhost:389/ou=People,o=JNDITutorial&amp;quot;);&lt;br /&gt;
    try {&lt;br /&gt;
      LdapContext ctx = new InitialLdapContext(env, null);&lt;br /&gt;
      // Activate paged results&lt;br /&gt;
      int pageSize = 5;&lt;br /&gt;
      byte[] cookie = null;&lt;br /&gt;
      ctx.setRequestControls(new Control[] { new PagedResultsControl(pageSize,&lt;br /&gt;
          Control.NONCRITICAL) });&lt;br /&gt;
      int total;&lt;br /&gt;
      do {&lt;br /&gt;
        /* perform the search */&lt;br /&gt;
        NamingEnumeration results = ctx.search(&amp;quot;&amp;quot;, &amp;quot;(objectclass=*)&amp;quot;,&lt;br /&gt;
            new SearchControls());&lt;br /&gt;
        /* for each entry print out name + all attrs and values */&lt;br /&gt;
        while (results != null &amp;amp;&amp;amp; results.hasMore()) {&lt;br /&gt;
          SearchResult entry = (SearchResult) results.next();&lt;br /&gt;
          System.out.println(entry.getName());&lt;br /&gt;
        }&lt;br /&gt;
        // Examine the paged results control response&lt;br /&gt;
        Control[] controls = ctx.getResponseControls();&lt;br /&gt;
        if (controls != null) {&lt;br /&gt;
          for (int i = 0; i &amp;lt; controls.length; i++) {&lt;br /&gt;
            if (controls[i] instanceof PagedResultsResponseControl) {&lt;br /&gt;
              PagedResultsResponseControl prrc = (PagedResultsResponseControl) controls[i];&lt;br /&gt;
              total = prrc.getResultSize();&lt;br /&gt;
              if (total != 0) {&lt;br /&gt;
                System.out.println(&amp;quot;(total : &amp;quot; + total);&lt;br /&gt;
              } else {&lt;br /&gt;
                System.out.println(&amp;quot;(total: unknown)&amp;quot;);&lt;br /&gt;
              }&lt;br /&gt;
              cookie = prrc.getCookie();&lt;br /&gt;
            }&lt;br /&gt;
          }&lt;br /&gt;
        } else {&lt;br /&gt;
          System.out.println(&amp;quot;No controls were sent from the server&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        ctx.setRequestControls(new Control[] { new PagedResultsControl(&lt;br /&gt;
            pageSize, cookie, Control.CRITICAL) });&lt;br /&gt;
      } while (cookie != null);&lt;br /&gt;
      ctx.close();&lt;br /&gt;
    } catch (NamingException e) {&lt;br /&gt;
      System.err.println(&amp;quot;PagedSearch failed.&amp;quot;);&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    } catch (IOException ie) {&lt;br /&gt;
      System.err.println(&amp;quot;PagedSearch failed.&amp;quot;);&lt;br /&gt;
      ie.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>