Package org.apache.directory.shared.ldap.model.message.controls

Examples of org.apache.directory.shared.ldap.model.message.controls.PagedResults


            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        PagedResults pagedSearch = (PagedResults)decorator.decode( bb.array() );

        assertEquals( Integer.MAX_VALUE, pagedSearch.getSize() );
        assertTrue( Arrays.equals( Strings.getBytesUtf8("test"),
            pagedSearch.getCookie() ) );
           
        bb.flip();


        PagedResultsDecorator ctrl = new PagedResultsDecorator( codec );
View Full Code Here


            } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );
       
        PagedResults pagedSearch = (PagedResults)decorator.decode( bb.array() );

        assertEquals( 32, pagedSearch.getSize() );
        assertNull( pagedSearch.getCookie() );
           
        PagedResultsDecorator ctrl = new PagedResultsDecorator( codec );
        ctrl.setSize( 32 );
        ctrl.setCookie( null );
View Full Code Here

        if ( !super.equals( o ) )
        {
            return false;
        }

        PagedResults otherControl = ( PagedResults ) o;

        return ( getSize() == otherControl.getSize() ) && Arrays.equals( getCookie(), otherControl.getCookie() );
    }
View Full Code Here

     * Manage the abandoned Paged Search (when paged size = 0). We have to
     * remove the cookie and its associated cursor from the session.
     */
    private SearchResultDone abandonPagedSearch( LdapSession session, SearchRequest req ) throws Exception
    {
        PagedResults pagedSearchControl = (PagedResults)req.getControls().get( PagedResults.OID );
        byte[] cookie = pagedSearchControl.getCookie();

        if ( !Strings.isEmpty(cookie) )
        {
            // If the cookie is not null, we have to destroy the associated
            // cursor stored into the session (if any)
            int cookieValue = pagedSearchControl.getCookieValue();
            PagedSearchContext psCookie = session.removePagedSearchContext( cookieValue );
            pagedSearchControl.setCookie( psCookie.getCookie() );
            pagedSearchControl.setSize( 0 );
            pagedSearchControl.setCritical( true );

            // Close the cursor
            EntryFilteringCursor cursor = psCookie.getCursor();

            if ( cursor != null )
            {
                cursor.close();
            }
        }
        else
        {
            pagedSearchControl.setSize( 0 );
            pagedSearchControl.setCritical( true );
        }

        // and return
        // DO NOT WRITE THE RESPONSE - JUST RETURN IT
        LdapResult ldapResult = req.getResultResponse().getLdapResult();
View Full Code Here

        if ( !super.equals( o ) )
        {
            return false;
        }

        PagedResults otherControl = ( PagedResults ) o;

        return ( getSize() == otherControl.getSize() ) && Arrays.equals( getCookie(), otherControl.getCookie() );
    }
View Full Code Here

        } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );

        PagedResults pagedSearch = ( PagedResults ) decorator.decode( bb.array() );

        assertEquals( 32, pagedSearch.getSize() );
        assertTrue( Arrays.equals( Strings.getBytesUtf8( "test" ),
            pagedSearch.getCookie() ) );

        bb.flip();

        PagedResultsDecorator ctrl = new PagedResultsDecorator( codec );
        ctrl.setSize( 32 );
View Full Code Here

        } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );

        PagedResults pagedSearch = ( PagedResults ) decorator.decode( bb.array() );

        assertEquals( Integer.MAX_VALUE, pagedSearch.getSize() );
        assertTrue( Arrays.equals( Strings.getBytesUtf8( "test" ),
            pagedSearch.getCookie() ) );

        bb.flip();

        PagedResultsDecorator ctrl = new PagedResultsDecorator( codec );
        ctrl.setSize( -1 );
View Full Code Here

        } );
        bb.flip();

        PagedResultsDecorator decorator = new PagedResultsDecorator( codec );

        PagedResults pagedSearch = ( PagedResults ) decorator.decode( bb.array() );

        assertEquals( 32, pagedSearch.getSize() );
        assertNull( pagedSearch.getCookie() );

        PagedResultsDecorator ctrl = new PagedResultsDecorator( codec );
        ctrl.setSize( 32 );
        ctrl.setCookie( null );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.message.controls.PagedResults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.