Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) new template to display the dir-listing in xml format. This can e.g. be done by using the url http://localhost:8080/share/?format=xml
theli777e39cea0ef
diff --git a/htroot/htdocsdefault/dir.java b/htroot/htdocsdefault/dir.javaindex 3a64ea1b6..a4db30398 100644--- a/htroot/htdocsdefault/dir.java+++ b/htroot/htdocsdefault/dir.java@@ -238,7 +238,7 @@ public class dir {// tree += "<span class=\"tt\">path = " + path + "</span><br><br>";if (list != null) {int filecount = 0, fileIdx = 0;- prop.put("path", path);+ prop.putNoHTML("path", path);boolean dark = false;for (int i = 0; i < list.length; i++) {@@ -280,8 +280,9 @@ public class dir {// last modification date if the entryprop.put("dirlist_" + fileIdx + "_dir_date" , dateString(new Date(f.lastModified())));+ prop.put("dirlist_" + fileIdx + "_dir_timestamp" , Long.toString(f.lastModified()));// the entry name- prop.put("dirlist_" + fileIdx + "_dir_name" , fileName);+ prop.putNoHTML("dirlist_" + fileIdx + "_dir_name" , fileName);if (f.isDirectory()) {// the entry is a directory@@ -293,9 +294,10 @@ public class dir {// the entry is a fileprop.put("dirlist_" + fileIdx + "_dir" , 0);// the file size- prop.put("dirlist_" + fileIdx + "_dir_size" , serverMemory.bytesToString(f.length()).replaceAll(" ", " "));+ prop.put("dirlist_" + fileIdx + "_dir_size" , serverMemory.bytesToString(f.length()));+ prop.put("dirlist_" + fileIdx + "_dir_sizeBytes" , Long.toString(f.length()));// the unique url- prop.put("dirlist_" + fileIdx + "_dir_yacyhURL",yacyhURL(yacyCore.seedDB.mySeed, fileName, md5s));+ prop.putNoHTML("dirlist_" + fileIdx + "_dir_yacyhURL",yacyhURL(yacyCore.seedDB.mySeed, fileName, md5s));// the md5 sum of the fileprop.put("dirlist_" + fileIdx + "_dir_md5s",md5s);// description mode: 0...image preview, 1...description text@@ -303,7 +305,7 @@ public class dir {if (showImage) {prop.put("dirlist_" + fileIdx + "_dir_descriptionMode_image",fileName);} else {- prop.put("dirlist_" + fileIdx + "_dir_descriptionMode_text",description);+ prop.putNoHTML("dirlist_" + fileIdx + "_dir_descriptionMode_text",description);}}diff --git a/htroot/htdocsdefault/dir.xml b/htroot/htdocsdefault/dir.xmlnew file mode 100644index 000000000..4615afd84--- /dev/null+++ b/htroot/htdocsdefault/dir.xml@@ -0,0 +1,20 @@+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>+<share path="#[path]#">+#{dirlist}#+ #(dir)#+ <file>+ <name>#[name]#</name>+ <date timestamp="#[timestamp]#">#[date]#</date>+ <size bytes="#[sizeBytes]#">#[size]#</size>+ <md5>#[md5s]#</md5>+ <comment>#(descriptionMode)##[text]#::#[text]##(/descriptionMode)#</comment>+ <yacyURL>#[yacyhURL]#</yacyURL>+ </file>+ ::+ <directory>+ <name>#[name]#</name>+ <date timestamp="#[timestamp]#">#[date]#</date>+ </directory>+ #(/dir)#+#{/dirlist}#+</share>\ No newline at end of filediff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.javaindex d74c6d4c6..8a3198d89 100644--- a/source/de/anomic/http/httpdFileHandler.java+++ b/source/de/anomic/http/httpdFileHandler.java@@ -460,10 +460,11 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http}//no defaultfile, send a dirlistingif(targetFile == null || !targetFile.exists()){- targetFile = getOverlayedFile("/htdocsdefault/dir.html");- targetClass=getOverlayedClass("/htdocsdefault/dir.html");+ String dirlistFormat = (args==null)?"html":args.get("format","html");+ targetFile = getOverlayedFile("/htdocsdefault/dir." + dirlistFormat);+ targetClass=getOverlayedClass("/htdocsdefault/dir." + dirlistFormat);if(! (( targetFile != null && targetFile.exists()) && ( targetClass != null && targetClass.exists())) ){- httpd.sendRespondError(this.connectionProperties,out,3,500,"dir.html or dir.class not found.",null,null);+ httpd.sendRespondError(this.connectionProperties,out,3,500,"dir." + dirlistFormat + " or dir.class not found.",null,null);}}}else{