org.apache.directory.shared.ldap.codec.search.controls.pagedSearch
Class PagedResultsControl

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.controls.AbstractControl
          extended by org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControl
All Implemented Interfaces:
Asn1Object, CodecControl, Control

public class PagedResultsControl
extends AbstractControl

A request/response control used to implement a simple paging of search results. This is an implementation of RFC 2696 : LDAP Control Extension for Simple Paged Results Manipulation

    This control is included in the searchRequest and searchResultDone
    messages as part of the controls field of the LDAPMessage, as defined
    in Section 4.1.12 of [LDAPv3]. The structure of this control is as
    follows:

 pagedResultsControl ::= SEQUENCE {
         controlType     1.2.840.113556.1.4.319,
         criticality     BOOLEAN DEFAULT FALSE,
         controlValue    searchControlValue
 }
 
 The searchControlValue is an OCTET STRING wrapping the BER-encoded
 version of the following SEQUENCE:
 
 realSearchControlValue ::= SEQUENCE {
         size            INTEGER (0..maxInt),
                                 -- requested page size from client
                                 -- result set size estimate from server
         cookie          OCTET STRING
 }
 
 

Version:
$Rev: $
Author:
Apache Directory Project

Field Summary
static java.lang.String CONTROL_OID
          The Paged Search Control OID
 
Fields inherited from class org.apache.directory.shared.ldap.codec.controls.AbstractControl
decoder, value, valueLength
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
PagedResultsControl()
           
 
Method Summary
 int computeLength()
          Compute the PagedSearchControl length, which is the sum of the control length and the value length.
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encodes the paged search control.
 byte[] getCookie()
           
 int getCookieValue()
           
 int getSize()
           
 byte[] getValue()
          Get the control value
 void setCookie(byte[] cookie)
          Set the cookie
 void setSize(int size)
          Set the number of entry requested or returned
 java.lang.String toString()
          Return a String representing this PagedSearchControl.
 
Methods inherited from class org.apache.directory.shared.ldap.codec.controls.AbstractControl
computeLength, getDecoder, getOid, hasValue, isCritical, setCritical, setValue
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTROL_OID

public static final java.lang.String CONTROL_OID
The Paged Search Control OID

See Also:
Constant Field Values
Constructor Detail

PagedResultsControl

public PagedResultsControl()
See Also:
Asn1Object#Asn1Object
Method Detail

computeLength

public int computeLength()
Compute the PagedSearchControl length, which is the sum of the control length and the value length.
 PagedSearchControl value length :
 
 0x30 L1 
   | 
   +--> 0x02 0x0(1-4) [0..2^63-1] (size) 
   +--> 0x04 L2 (cookie)
 

Specified by:
computeLength in interface Asn1Object
Specified by:
computeLength in interface CodecControl
Overrides:
computeLength in class AbstractControl
Returns:
The object's computed length

encode

public java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
                           throws EncoderException
Encodes the paged search control.

Specified by:
encode in interface Asn1Object
Specified by:
encode in interface CodecControl
Overrides:
encode in class AbstractControl
Parameters:
buffer - The encoded sink
Returns:
A ByteBuffer that contains the encoded PDU
Throws:
EncoderException - If anything goes wrong.

getValue

public byte[] getValue()
Get the control value

Specified by:
getValue in interface Control
Overrides:
getValue in class AbstractControl
Returns:
The control value

getSize

public int getSize()
Returns:
The requested or returned number of entries

setSize

public void setSize(int size)
Set the number of entry requested or returned

Parameters:
size - The number of entries

getCookie

public byte[] getCookie()
Returns:
The stored cookie

setCookie

public void setCookie(byte[] cookie)
Set the cookie

Parameters:
cookie - The cookie to store in this control

getCookieValue

public int getCookieValue()
Returns:
The integer value for the current cookie

toString

public java.lang.String toString()
Return a String representing this PagedSearchControl.

Overrides:
toString in class AbstractControl


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.