jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Tran <dant...@gmail.com>
Subject Extra entry in get file list with jackrabbit webdav
Date Sat, 03 Jan 2009 07:29:33 GMT


Hi I am a developer at maven wagon.  we use jackrabbit 1.5.0 to list the
content of a webdev directory.
However, the jackrabbit webdav always return an extra entry which is the
directory of the parent

so here is the code

                DavPropertyNameSet nameSet = new DavPropertyNameSet();
                nameSet.add( DavPropertyName.create(
DavConstants.PROPERTY_DISPLAYNAME ) );

                method = new PropFindMethod( url, nameSet,
DavConstants.DEPTH_1 );
                int status = execute( method );
                if ( method.succeeded() )
                {
                    ArrayList dirs = new ArrayList();
                    MultiStatus multiStatus =
method.getResponseBodyAsMultiStatus();

                    for ( int i = 0; i < multiStatus.getResponses().length;
i++ )
                    {
                        
                        MultiStatusResponse response =
multiStatus.getResponses()[i];
                        
                        String entryUrl =  response.getHref();
                        String fileName = PathUtils.filename(
URLDecoder.decode( entryUrl ) );
                        if ( entryUrl.endsWith( "/" ) )
                        {
                            if ( i == 0 )
                            {
                                //bug in jackrabbit webdav 1.5.0 where first
entry of the list is
                                // the parent directory 
                                continue;
                            }
                            //extract dir/ part of path.to.dir/
                            fileName = PathUtils.filename(
PathUtils.dirname( URLDecoder.decode( entryUrl ) ) ) + "/";
                        }
                        
                        if ( !StringUtils.isEmpty( fileName ) )
                        {
                            dirs.add( fileName );
                        }
                    }
                    return dirs;
                }


It means if url is ${url.to.webdav}/dir, the first entry in the list is
"dir/" 

Could someone confirm this?  so that I can go ahead to file a JIRA

is there a work around?

Thanks

-Dan
-- 
View this message in context: http://www.nabble.com/Extra-entry-in-get-file-list-with-jackrabbit-webdav-tp21262786p21262786.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message