*/
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, NotAuthorizedException {
String subpath = getFile().getCanonicalPath().substring(factory.getRoot().getCanonicalPath().length()).replace('\\', '/');
String uri = subpath;
//String uri = "/" + factory.getContextPath() + subpath;
XmlWriter w = new XmlWriter(out);
w.open("html");
w.open("head");
w.writeText(""
+ "<script type=\"text/javascript\" language=\"javascript1.1\">\n"
+ " var fNewDoc = false;\n"
+ " </script>\n"
+ " <script LANGUAGE=\"VBSCRIPT\">\n"
+ " On Error Resume Next\n"
+ " Set EditDocumentButton = CreateObject(\"SharePoint.OpenDocuments.3\")\n"
+ " fNewDoc = IsObject(EditDocumentButton)\n"
+ " </script>\n"
+ " <script type=\"text/javascript\" language=\"javascript1.1\">\n"
+ " var L_EditDocumentError_Text = \"The edit feature requires a SharePoint-compatible application and Microsoft Internet Explorer 4.0 or greater.\";\n"
+ " var L_EditDocumentRuntimeError_Text = \"Sorry, couldnt open the document.\";\n"
+ " function editDocument(strDocument) {\n"
+ " if (fNewDoc) {\n"
+ " if (!EditDocumentButton.EditDocument(strDocument)) {\n"
+ " alert(L_EditDocumentRuntimeError_Text); \n"
+ " }\n"
+ " } else { \n"
+ " alert(L_EditDocumentError_Text); \n"
+ " }\n"
+ " }\n"
+ " </script>\n");
w.close("head");
w.open("body");
w.begin("h1").open().writeText(this.getName()).close();
w.open("table");
for (Resource r : getChildren()) {
w.open("tr");
w.open("td");
String path = buildHref(uri, r.getName());
w.begin("a").writeAtt("href", path).open().writeText(r.getName()).close();
w.begin("a").writeAtt("href", "#").writeAtt("onclick", "editDocument('" + path + "')").open().writeText("(edit with office)").close();
w.close("td");
w.begin("td").open().writeText(r.getModifiedDate() + "").close();
w.close("tr");
}
w.close("table");
w.close("body");
w.close("html");
w.flush();
}