Package org.apache.directory.shared.asn1.ber.tlv

Examples of org.apache.directory.shared.asn1.ber.tlv.TLV


    public void action( LdapMessageContainer<SearchResultReferenceDecorator> container ) throws DecoderException
    {
        SearchResultReference searchResultReference = container.getMessage();

        // Get the Value and store it in the BindRequest
        TLV tlv = container.getCurrentTLV();

        // Get the referral, or create it if not existing
        Referral referral = searchResultReference.getReferral();

        if ( referral == null )
        {
            referral = new ReferralImpl();
            searchResultReference.setReferral( referral );
        }

        // We have to handle the special case of a 0 length list of referrals
        LdapURL url = LdapURL.EMPTY_URL;

        if ( tlv.getLength() == 0 )
        {
            referral.addLdapUrl( "" );
        }
        else
        {
            String urlStr = Strings.utf8ToString(tlv.getValue().getData());

            try
            {
                url = new LdapURL( urlStr );
                referral.addLdapUrl( urlStr );
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        if ( tlv.getLength() == 0 )
        {
            String msg = I18n.err( I18n.ERR_04010 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }
View Full Code Here

     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();
        TLV tlv = container.getCurrentTLV();
        String attributeDescription = null;

        if ( tlv.getLength() != 0 )
        {
            attributeDescription = Strings.utf8ToString(tlv.getValue().getData());

            // If the attributeDescription is empty, we won't add it
            if ( !Strings.isEmpty(attributeDescription.trim()) )
            {
                searchRequestDecorator.getDecorated().addAttributes( attributeDescription );
View Full Code Here

     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequest = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        // Store the value.
        SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getTerminalFilter();

        if ( tlv.getLength() == 0 )
        {
            String msg = I18n.err( I18n.ERR_04020 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        String finalValue = Strings.utf8ToString(tlv.getValue().getData());
        substringFilter.setFinalSubstrings( finalValue );

        // We now have to get back to the nearest filter which is
        // not terminal.
        searchRequest.unstackFilters( container );
View Full Code Here

     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<MessageDecorator<? extends Message>> container ) throws DecoderException
    {
        // Get the Value and store it in the BindResponse
        TLV tlv = container.getCurrentTLV();
        String errorMessage = null;

        // We have to handle the special case of a 0 length error
        // message
        if ( tlv.getLength() == 0 )
        {
            errorMessage = "";
        }
        else
        {
            errorMessage = Strings.utf8ToString(tlv.getValue().getData());
        }

        ResultResponse response = ( ResultResponse ) container.getMessage();
        LdapResult ldapResult = response.getLdapResult();
        ldapResult.setErrorMessage( errorMessage );
View Full Code Here

     */
    public void action( LdapMessageContainer<AddRequestDecorator> container )
    {
        AddRequestDecorator addRequest = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        // Store the value. It can't be null
        Object value = null;

        if ( tlv.getLength() == 0 )
        {
            addRequest.addAttributeValue( "" );
        }
        else
        {
            if ( container.isBinary( addRequest.getCurrentAttributeType() ) )
            {
                value = tlv.getValue().getData();

                if ( IS_DEBUG )
                {
                    LOG.debug( "Adding value {}", Strings.dumpBytes((byte[]) value) );
                }

                addRequest.addAttributeValue( ( byte[] ) value );
            }
            else
            {
                value = Strings.utf8ToString(tlv.getValue().getData());

                if ( IS_DEBUG )
                {
                    LOG.debug( "Adding value {}" + value );
                }
View Full Code Here

     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<BindResponseDecorator> container ) throws DecoderException
    {
        // Get the Value and store it in the BindRequest
        TLV tlv = container.getCurrentTLV();

        // We have to handle the special case of a 0 length server
        // sasl credentials
        byte[] serverSaslCreds = null;

        if ( tlv.getLength() == 0 )
        {
            serverSaslCreds = StringConstants.EMPTY_BYTES;
        }
        else
        {
            serverSaslCreds = tlv.getValue().getData();
        }

        BindResponse response = container.getMessage();
        response.setServerSaslCreds( serverSaslCreds );

View Full Code Here

            catch ( InvalidMarkException ime )
            {
                stream.rewind();
            }

            TLV tlv = kerberosMessageContainer.getCurrentTLV();
            kerberosMessageContainer.setGrammarEndAllowed( true );

            // Now, depending on the T, call the inner decoder
            switch ( tlv.getTag() )
            {
                case KerberosConstants.AS_REQ_TAG:
                    AsReqContainer asReqContainer = new AsReqContainer( stream );

                    // Decode the AS_REQ PDU
View Full Code Here

            container.getLdapCodecService(), internalAbandonRequest );
        container.setMessage( abandonRequest );

        // The current TLV should be a integer
        // We get it and store it in MessageId
        TLV tlv = container.getCurrentTLV();

        Value value = tlv.getValue();

        if ( ( value == null ) || ( value.getData() == null ) )
        {
            String msg = I18n.err( I18n.ERR_04075 );
            LOG.error( msg );
View Full Code Here

            catch ( InvalidMarkException ime )
            {
                stream.rewind();
            }

            TLV tlv = kerberosMessageContainer.getCurrentTLV();
            kerberosMessageContainer.setGrammarEndAllowed( true );

            // Now, depending on the T, call the inner decoder
            switch ( tlv.getTag() )
            {
                case KerberosConstants.AS_REQ_TAG:
                    AsReqContainer asReqContainer = new AsReqContainer( stream );

                    // Decode the AS_REQ PDU
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.ber.tlv.TLV

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.