Jonathan,
I've added some information to the Wiki
http://wiki.apache.org/jakarta-slide/CreateNewSlideStore and I'll see
if I can get someone with more experience writing Stores to spruce up
the documentation a little.

-James

>>> [EMAIL PROTECTED] 7/2/2004 9:21:33 AM >>>
Thanks for pointing me in the right direction James.  Turns out the
problem
was that the isCollection() method was failing for real files and the
generic GET method was being called instead of the WedDAV Server
specific
one.

I finally figured out the reason why.  I was improperly populating the
latestRevisionNumbers Hashtable when I was creating the
NodeRevisionDescriptors object in my store's
retrieveRevisionDescriptors(Uri
uri) method for files.  By the way, the key value format for that
Hashtable
is (String branchName, NodeRevisionNumber nodeRevisionNumber)

Aside:  I know that Slide is free software and we're all in this
together,
but this highlights one of the most frustrating aspects of the lack of
documentation for new developers.  The JavaDoc for the
NodeRevisionDescriptors object tells you that the constructor method
takes
three Hashtables as arguments but does not inform you what the
structure of
the key/value objects should be.  A Hashtable is pretty generic.  It
wasn't
until I found a separate method in the source that I saw the value
object of
that Hashtable was being cast as a NodeRevisionNumber.  It wouldn't
hurt to
include something in the Javadoc comments for those constructors
indicating
the format of generic things like Hashtables, Enumerations, etc.

Jonathan

-----Original Message-----
From: James Mason [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 01, 2004 11:31 AM
To: [EMAIL PROTECTED] 
Subject: Re: Problems with retrieveRevision Content

What you're describing should be working. It looks like the WebDAV
servlet
thinks that your file is a collection. I don't know how it determines
this,
but a GET request to a collection will result in the kind of response
that
you're getting.

The only thing I can suggest is to add some debugging output to try to
find
out why the servlet thinks the file is a directory.

-James

>>> [EMAIL PROTECTED] 6/30/2004 3:50:31 PM >>>
I am continuing to try and create my own content store to eventually
hook
into an existing Content Management Application that has an exposed
API.  I
have gotten as far as given a URI like "/slide/files/1234" I return
that
it's a collection and it contains a Word document named
"1234Document.doc".
Opening a Windows XP network place to http://host/slide/files/1234 
<http://host/slide/files/1234>  results in a Word icon with the
correct
name.  My goal is that when I click on the Word icon on the network
place to
open the document in Word, the contents of the document will simply be
"File
ID = 1234".  (I call setContent method on NodeRevisionContent object
to
manipulate the data).  However, when I click to open the Word document
now,
its contents are the HTML that would result if you were to browse
http://host/slide/files/1234 <http://host/slide/files/1234>  using a
non
WebDAV client like IE.  It doesn't appear that my
retrieveRevisionContent()
method is ever being called.

1.  What determines with retrieveRevisionContent() should be called?
2.  Collections are identified as resourceType = <collection/>.  How
should
actual files be identified?  Does that matter?

Here are some code details

When retrieveObject(Uri uri) is called for a uri like "/files/1234"
==================
UriPath uriPath = new UriPath(uri.toString()); Vector children = new
Vector(); String childFileName = uriPath.lastSegment() + Document.doc"
//Make containing file like "1234Document.doc"
children.add(0,childFileName);
Vector links = new Vector(); //Empty links vector return new
SubjectNode(uri.toString(), children, links);


When retrieveObject(Uri) is called for a uri like
"/files/1234/1234Document.doc"
==================
return new SubjectNode(uri.toString());


When retrieveRevisionDescriptor(Uri uri, NodeRevisionNumber
revisionNumber)
is called
==================
If(revisionNumber == null){revisionNumber = new
NodeRevisionNumber("1.0");}
String branchName = "main"; Vector labels = new Vector(); //Empty
labels
vector Hashtable properties = new Hashtable(); NodeRevisionDescriptor
nrd =
new NodeRevisionDescriptor(revisionNumber,
branchName, labels, properties);
------------then-------------
When the uri is like "/files/1234"
-------------------------------
nrd.setResourceType("<collection/>");
nrd.setSource("");
nrd.setContentLength("0");
-----------but---------------
When the uri is like "/files/1234/1234Document.doc"
------------------------------
nrd.setResourceType("");
nrd.setSource("");
nrd.setContentLanguage("en");
nrd.setContentLength("24064");
nrd.setContentType("application/msword");
nrd.setName(uriPath.lastSegment()); //Sets the name to
"1234Document.doc"


The final bit when retrieveRevisionContent(Uri uri,
NodeRevisionDescriptor
revisionDescriptor) is called for a uri like
"/files/1234/1234Document.doc"
====================
String s = new String("File ID = " + uriPath.lastSegment()); // "File
ID =
1234"
NodeRevisionContent result = new NodeRevisionContent();
result.setContent(s.toCharArray());
return result;

When I double click on the Word Icon labeled "1234Document.doc" in the
Network Place", instead of a Word opening the document with the content
I
placed in the result using setContents() method when the GET request
comes
through, the content of the Word Document is HTML as if I was browsing
using
IE.

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" >
</meta>
<title>Directory listing for /files/1234/1234Document.doc</title>
</head>
<body bgcolor="white">
<table width="90%" cellspacing="0" cellpadding="5" align="center">
<tr><td
colspan="3"><font size="+2"> <strong>Directory listing for
/files/1234/1234Document.doc</strong>
</font></td></tr>
<tr><td colspan="5" bgcolor="#ffffff">
<a href="/slide/files/1234">Up To /files/1234</a> </td></tr> <tr><td
colspan="5" bgcolor="#ffffff">&nbsp;</td></tr>
<tr bgcolor="#cccccc">
<td align="left" colspan="3"><font
size="+1"><strong>Filename</strong></font></td>
<td align="center"><font size="+1"><strong>Size</strong></font></td>
<td align="right"><font size="+1"><strong>Last
Modified</strong></font></td>
</tr> <tr><td colspan="5">&nbsp;</td></tr> <tr><td colspan="3"
bgcolor="#cccccc"><font size="-1">Jakarta Slide 2.0</font></td> <td
colspan="2" align="right" bgcolor="#cccccc"><font size="-1"> 4c Wed, 30
Jun
2004 17:30:29 EDT</font></td></tr> </table> </body> </html>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to