[ 
https://issues.apache.org/jira/browse/DIRAPI-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lecharny updated DIRAPI-139:
-------------------------------------

    Fix Version/s:     (was: 1.0.0-RC1)
                   1.0.0-M18
    
> o.a.d.api.ldap.codec.api.LdapEncoder should log encoded PDU via DEBUG
> ---------------------------------------------------------------------
>
>                 Key: DIRAPI-139
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-139
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0-M17
>            Reporter: Hendy Irawan
>             Fix For: 1.0.0-M18
>
>
> o.a.d.api.ldap.codec.api.LdapDecoder has a nice feature to output the PDU :
> {code}
> 13:30:25.933 [NioProcessor-1] DEBUG o.a.d.api.ldap.codec.api.LdapDecoder - 
> Decoding the PDU : 
> 13:30:25.934 [NioProcessor-1] DEBUG o.a.d.api.ldap.codec.api.LdapDecoder - 
> 0x30 0x32 0x02 0x01 0x02 0x65 0x2D 0x0A 0x01 0x02 0x04 0x00 0x04 0x26 0x73 
> 0x6F 0x72 0x74 0x65 0x64 0x20 0x72 0x65 0x73 0x75 0x6C 0x74 0x73 0x20 0x63 
> 0x6F 0x6E 0x74 0x72 0x6F 0x6C 0x20 0x76 0x61 0x6C 0x75 0x65 0x20 0x69 0x73 
> 0x20 0x61 0x62 0x73 0x65 0x6E 0x74 
> {code}
> However LdapEncoder doesn't do this, although LdapNetworkConnection outputs a 
> textual form: (note the "-----" divider is superfluous, can it be removed?)
> {code}
> 13:30:25.932 [main] DEBUG o.a.d.l.c.api.LdapNetworkConnection - 
> -----------------------------------------------------------------
> 13:30:25.933 [main] DEBUG o.a.d.l.c.api.LdapNetworkConnection - Sending 
> request 
> MessageType : SEARCH_REQUEST
> Message ID : 2
>     SearchRequest
>         baseDn : 'dc=dev,dc=tuneeca,dc=com'
>         filter : '(sn=*)'
>         scope : single level
>         typesOnly : false
>         Size Limit : no limit
>         Time Limit : no limit
>         Deref Aliases : deref Always
>         attributes : 
> org.apache.directory.api.ldap.model.message.SearchRequestImpl@25dcb2bc    
> ServerSideSort Control
>         Type OID    : '1.2.840.113556.1.4.473'
>         Criticality : 'false'
> '
> {code}
> I had to use code (while trying to implement #DIRAPI-137) such as:
> {code}
> SearchRequestImpl search = new SearchRequestImpl();
> //                                            search.setBase(new Dn(baseDn));
> search.setBase(new Dn("dc=dev,dc=tuneeca,dc=com"));
> search.setFilter(filter);
> search.setScope(SearchScope.ONELEVEL);
> String sortProperty = pageable.getSort().iterator().next().getProperty();
> ServerSideSort skl = new ServerSideSort(sortProperty);
> search.addControl(skl);
> // debug stuff
> ProtocolCodecSession session = new ProtocolCodecSession();
> ProtocolEncoder encoder = new LdapProtocolEncoder();
> encoder.encode(session, search, session.getEncoderOutput());
> IoBuffer buffer = (IoBuffer) session.getEncoderOutputQueue().poll();
> HexDump.dump(buffer.array(), 0, System.out, 0);
> // debug stuff
> {code}
> In order to get output such as:
> {code}
> 00000000 30 50 02 01 FF 63 2F 04 18 64 63 3D 64 65 76 2C 0P...c/..dc=dev,
> 00000010 64 63 3D 74 75 6E 65 65 63 61 2C 64 63 3D 63 6F dc=tuneeca,dc=co
> 00000020 6D 0A 01 01 0A 01 03 02 01 00 02 01 00 01 01 00 m...............
> 00000030 87 02 73 6E 30 00 A0 1A 30 18 04 16 31 2E 32 2E ..sn0...0...1.2.
> 00000040 38 34 30 2E 31 31 33 35 35 36 2E 31 2E 34 2E 34 840.113556.1.4.4
> 00000050 37 33                                           73
> {code}
> It would be great if o.a.d.api.ldap.codec.api.LdapEncoder can do this using 
> log DEBUG.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to