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"> </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"> </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>