You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Dan Tran <da...@gmail.com> on 2009/01/03 08:29:33 UTC

Extra entry in get file list with jackrabbit webdav


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.


Re: Extra entry in get file list with jackrabbit webdav

Posted by Dan Tran <da...@gmail.com>.
coolest

Thanks

-D

Julian Reschke wrote:
> 
> Dan Tran wrote:
>> Hi Julian,
>> 
>> Thank you for the quick answer?
>> 
>> I am going to search on webdav spec for this, if you happen to know where
>> it
>> is , please let me know
> 
> <http://www.webdav.org/specs/rfc4918.html#rfc.section.9.1>
> 
>> ...
> 
> Best regards, Julian
> 
> 

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


Re: Extra entry in get file list with jackrabbit webdav

Posted by Julian Reschke <ju...@gmx.de>.
Dan Tran wrote:
> Hi Julian,
> 
> Thank you for the quick answer?
> 
> I am going to search on webdav spec for this, if you happen to know where it
> is , please let me know

<http://www.webdav.org/specs/rfc4918.html#rfc.section.9.1>

> ...

Best regards, Julian

Re: Extra entry in get file list with jackrabbit webdav

Posted by Dan Tran <da...@gmail.com>.
Hi Julian,

Thank you for the quick answer?

I am going to search on webdav spec for this, if you happen to know where it
is , please let me know

In the mean while, could a another dev folk to confirm on this?, so that I
have a better feeling coding around it.

Thanks again

-Dan


Julian Reschke wrote:
> 
> Dan Tran wrote:
>> 
>> 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
>> ...
>> 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?
>> ...
> 
> I think it's by design. It gives you what the server returned, and for 
> depth 1, this is what a compliant server has to return...
> 
> BR, Julian
> 
> 

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


Re: Extra entry in get file list with jackrabbit webdav

Posted by Julian Reschke <ju...@gmx.de>.
Dan Tran wrote:
> 
> 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
> ...
> 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?
> ...

I think it's by design. It gives you what the server returned, and for 
depth 1, this is what a compliant server has to return...

BR, Julian