You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Julián Cerviño Iglesia <ju...@queres.com> on 2011/09/19 09:16:04 UTC
[vfs] webdav problem
Hi all,
I'm trying to use VFS2 to access a webdav server an replicate a folder
structure.
The problem is that the file system manager cannot determine the type of a
remote folder. I debugged the code and found that the root problem is a
Class Cast Exception in this method (class WebdavFileObject.java), somehow
property.getValue() is an ArrayList, and not a Node.
private boolean isDirectory(URLFileName name) throws IOException
{
try
{
DavProperty property = getProperty(name,
DavConstants.PROPERTY_RESOURCETYPE);
Node node;
--> if (property != null && (node = (Node) property.getValue()) != null)
{
return
node.getLocalName().equals(DavConstants.XML_COLLECTION);
}
else
{
return false;
}
}
catch (FileNotFoundException fse)
{
throw new FileNotFolderException(name);
}
}
Webdav Server its an Alfresco Repository, and other operations work fine
(for example copy a file), so the connection seems ok.
Thx in advance,
Julian
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [vfs] webdav problem
Posted by Ralph Goers <ra...@dslextreme.com>.
Sorry for taking so long to reply. I'm a bit confused as the XML response below contains <D:collection/> which, IIRC, is the indicator being checked for to indicate it is a folder. I can't see why that would turn into an ArrayList. Can you provide the stack trace for the ClassCastException?
If Alfresco is returning a Collection for this property then I'm guessing it will return Collections for all of them, which is also going to cause problems.
I think I'm going to have to download Alfresco and try it.
Ralph
On Sep 19, 2011, at 7:21 AM, Julián Cerviño Iglesia wrote:
> Hi,
>
> It's an ArrayList with 2 elements:
>
> [0] Type: DeferredElementNSImpl - Value: [D:collection: null]
> [1] Type: DeferredTextImpl - Value: [#text: \n ]
>
> And the exception: "java.util.ArrayList cannot be cast to org.w3c.dom.Node"
>
> I'm taking a look at the http conversation with WireShark and found that
> first response it's a 401 (but user/pass are ok and it seems we are using
> the correct JSESSIONID)...
>
> PROPFIND /alfresco/webdav/test/1 HTTP/1.1
> Depth: 0
> User-Agent: Jakarta-Commons-VFS
> Cache-control: no-cache
> Cache-store: no-store
> Pragma: no-cache
> Expires: 0
> Host: hostname
> Cookie: $Version=0; JSESSIONID=CE4C1C3825257DD4E320EAF32B6F08C6;
> $Path=/alfresco
> Content-Length: 112
> Content-Type: text/xml; charset=UTF-8
>
> <?xml version="1.0" encoding="UTF-8"?><D:propfind
> xmlns:D="DAV:"><D:prop><D:resourcetype/></D:prop></D:propfind>HTTP/1.1 401
> No Autorizado
> Date: Mon, 19 Sep 2011 14:14:33 GMT
> Server: Apache-Coyote/1.1
> WWW-Authenticate: BASIC realm="Alfresco DAV Server"
> Via: 1.1 hostname
> Content-Length: 0
> Content-Type: text/plain
>
> PROPFIND /alfresco/webdav/test/1 HTTP/1.1
> Depth: 0
> User-Agent: Jakarta-Commons-VFS
> Cache-control: no-cache
> Cache-store: no-store
> Pragma: no-cache
> Expires: 0
> Content-Length: 112
> Content-Type: text/xml; charset=UTF-8
> Authorization: Basic eGlhbjpqdWwwNzk=
> Host: hostname
> Cookie: $Version=0; JSESSIONID=CE4C1C3825257DD4E320EAF32B6F08C6;
> $Path=/alfresco
>
> <?xml version="1.0" encoding="UTF-8"?><D:propfind
> xmlns:D="DAV:"><D:prop><D:resourcetype/></D:prop></D:propfind>HTTP/1.1 207
> Multi-Estado
> Date: Mon, 19 Sep 2011 14:14:33 GMT
> Server: Apache-Coyote/1.1
> Content-Type: text/xml;charset=UTF-8
> Via: 1.1 hostname
> Vary: Accept-Encoding
> Transfer-Encoding: chunked
>
> 155
> <?xml version="1.0" encoding="UTF-8"?>
>
> <D:multistatus xmlns:D="DAV:">
> <D:response>
> <D:href>/alfresco/webdav/test/1/</D:href>
> <D:propstat>
> <D:prop>
> <D:resourcetype>
> <D:collection/></D:resourcetype>
> </D:prop>
> <D:status>HTTP/1.1 200 OK</D:status>
> </D:propstat>
> </D:response>
> </D:multistatus>
> 0
> Thx
>
> -----Mensaje original-----
> De: Ralph Goers [mailto:ralph.goers@dslextreme.com]
> Enviado el: lunes, 19 de septiembre de 2011 15:51
> Para: Commons Users List
> Asunto: Re: [vfs] webdav problem
>
> An ArrayList containing what?
>
> Ralph
>
> On Sep 19, 2011, at 12:16 AM, Julián Cerviño Iglesia wrote:
>
>> Hi all,
>>
>> I'm trying to use VFS2 to access a webdav server an replicate a folder
>> structure.
>>
>> The problem is that the file system manager cannot determine the type of a
>> remote folder. I debugged the code and found that the root problem is a
>> Class Cast Exception in this method (class WebdavFileObject.java), somehow
>> property.getValue() is an ArrayList, and not a Node.
>>
>> private boolean isDirectory(URLFileName name) throws IOException
>> {
>> try
>> {
>> DavProperty property = getProperty(name,
>> DavConstants.PROPERTY_RESOURCETYPE);
>> Node node;
>>
>> --> if (property != null && (node = (Node) property.getValue()) !=
> null)
>> {
>> return
>> node.getLocalName().equals(DavConstants.XML_COLLECTION);
>> }
>> else
>> {
>> return false;
>> }
>> }
>> catch (FileNotFoundException fse)
>> {
>> throw new FileNotFolderException(name);
>> }
>> }
>>
>> Webdav Server its an Alfresco Repository, and other operations work fine
>> (for example copy a file), so the connection seems ok.
>>
>> Thx in advance,
>> Julian
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
RE: [vfs] webdav problem
Posted by Julián Cerviño Iglesia <ju...@queres.com>.
Hi,
It's an ArrayList with 2 elements:
[0] Type: DeferredElementNSImpl - Value: [D:collection: null]
[1] Type: DeferredTextImpl - Value: [#text: \n ]
And the exception: "java.util.ArrayList cannot be cast to org.w3c.dom.Node"
I'm taking a look at the http conversation with WireShark and found that
first response it's a 401 (but user/pass are ok and it seems we are using
the correct JSESSIONID)...
PROPFIND /alfresco/webdav/test/1 HTTP/1.1
Depth: 0
User-Agent: Jakarta-Commons-VFS
Cache-control: no-cache
Cache-store: no-store
Pragma: no-cache
Expires: 0
Host: hostname
Cookie: $Version=0; JSESSIONID=CE4C1C3825257DD4E320EAF32B6F08C6;
$Path=/alfresco
Content-Length: 112
Content-Type: text/xml; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><D:propfind
xmlns:D="DAV:"><D:prop><D:resourcetype/></D:prop></D:propfind>HTTP/1.1 401
No Autorizado
Date: Mon, 19 Sep 2011 14:14:33 GMT
Server: Apache-Coyote/1.1
WWW-Authenticate: BASIC realm="Alfresco DAV Server"
Via: 1.1 hostname
Content-Length: 0
Content-Type: text/plain
PROPFIND /alfresco/webdav/test/1 HTTP/1.1
Depth: 0
User-Agent: Jakarta-Commons-VFS
Cache-control: no-cache
Cache-store: no-store
Pragma: no-cache
Expires: 0
Content-Length: 112
Content-Type: text/xml; charset=UTF-8
Authorization: Basic eGlhbjpqdWwwNzk=
Host: hostname
Cookie: $Version=0; JSESSIONID=CE4C1C3825257DD4E320EAF32B6F08C6;
$Path=/alfresco
<?xml version="1.0" encoding="UTF-8"?><D:propfind
xmlns:D="DAV:"><D:prop><D:resourcetype/></D:prop></D:propfind>HTTP/1.1 207
Multi-Estado
Date: Mon, 19 Sep 2011 14:14:33 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Via: 1.1 hostname
Vary: Accept-Encoding
Transfer-Encoding: chunked
155
<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>/alfresco/webdav/test/1/</D:href>
<D:propstat>
<D:prop>
<D:resourcetype>
<D:collection/></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
0
Thx
-----Mensaje original-----
De: Ralph Goers [mailto:ralph.goers@dslextreme.com]
Enviado el: lunes, 19 de septiembre de 2011 15:51
Para: Commons Users List
Asunto: Re: [vfs] webdav problem
An ArrayList containing what?
Ralph
On Sep 19, 2011, at 12:16 AM, Julián Cerviño Iglesia wrote:
> Hi all,
>
> I'm trying to use VFS2 to access a webdav server an replicate a folder
> structure.
>
> The problem is that the file system manager cannot determine the type of a
> remote folder. I debugged the code and found that the root problem is a
> Class Cast Exception in this method (class WebdavFileObject.java), somehow
> property.getValue() is an ArrayList, and not a Node.
>
> private boolean isDirectory(URLFileName name) throws IOException
> {
> try
> {
> DavProperty property = getProperty(name,
> DavConstants.PROPERTY_RESOURCETYPE);
> Node node;
>
> --> if (property != null && (node = (Node) property.getValue()) !=
null)
> {
> return
> node.getLocalName().equals(DavConstants.XML_COLLECTION);
> }
> else
> {
> return false;
> }
> }
> catch (FileNotFoundException fse)
> {
> throw new FileNotFolderException(name);
> }
> }
>
> Webdav Server its an Alfresco Repository, and other operations work fine
> (for example copy a file), so the connection seems ok.
>
> Thx in advance,
> Julian
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [vfs] webdav problem
Posted by Ralph Goers <ra...@dslextreme.com>.
An ArrayList containing what?
Ralph
On Sep 19, 2011, at 12:16 AM, Julián Cerviño Iglesia wrote:
> Hi all,
>
> I'm trying to use VFS2 to access a webdav server an replicate a folder
> structure.
>
> The problem is that the file system manager cannot determine the type of a
> remote folder. I debugged the code and found that the root problem is a
> Class Cast Exception in this method (class WebdavFileObject.java), somehow
> property.getValue() is an ArrayList, and not a Node.
>
> private boolean isDirectory(URLFileName name) throws IOException
> {
> try
> {
> DavProperty property = getProperty(name,
> DavConstants.PROPERTY_RESOURCETYPE);
> Node node;
>
> --> if (property != null && (node = (Node) property.getValue()) != null)
> {
> return
> node.getLocalName().equals(DavConstants.XML_COLLECTION);
> }
> else
> {
> return false;
> }
> }
> catch (FileNotFoundException fse)
> {
> throw new FileNotFolderException(name);
> }
> }
>
> Webdav Server its an Alfresco Repository, and other operations work fine
> (for example copy a file), so the connection seems ok.
>
> Thx in advance,
> Julian
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org