*) adding image tag into rss template

*) adding a xslt stylesheet so that the rss document can be viewed in a normal webbrowser
*) adding pubDate tag to each search item

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@173 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 6f09251bbc
commit 74eb21f62e

@ -244,7 +244,13 @@ public class index {
// return rewrite properties
prop.put("promoteSearchPageGreeting", env.getConfig("promoteSearchPageGreeting", ""));
return prop;
// adding some additional properties needed for the rss feed
String hostName = (String) header.get("Host","localhost");
if (hostName.indexOf(":") == -1) hostName += ":" + env.getConfig("port","8080");
prop.put("rssYacyImageURL","http://" + hostName + "/env/grafics/yacy.gif");
return prop;
}
public static TreeSet cleanQuery(String words) {

@ -1,12 +1,18 @@
<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='/index.xsl' version='1.0'?>
<rss version="2.0" xmlns:yacyTopwords="http://www.yacy.net/yacy/topwords">
<channel>
<title>Search for #[former]#</title>
<description>Search for #[former]#</description>
<image>
<url>#[rssYacyImageURL]#</url>
<title>Search for #[former]#</title>
</image>
#{results}#
<item>
<title>#[description]#</title>
<link>#[url]#</link>
<pubDate>#[date]#</pubDate>
</item>
#{/results}#
<yacyTopwords:topwords>

@ -73,6 +73,7 @@ wav = audio/x-wav
xhtml = application/xhtml+xml
xla = application/msexcel
xls = application/msexcel
xsl = application/xml
xml = application/xml
Z = application/x-compress
zip = application/zip

@ -65,7 +65,7 @@ import de.anomic.server.serverFileUtils;
public class mimeTypeParser
extends AbstractParser
implements Parser {
/**
* a list of mime types that are supported by this parser class
* @see #getSupportedMimeTypes()
@ -88,10 +88,10 @@ implements Parser {
"xerces.jar"
};
public mimeTypeParser() {
super(LIBX_DEPENDENCIES);
}
public mimeTypeParser() {
super(LIBX_DEPENDENCIES);
}
public plasmaParserDocument parse(URL location, String mimeType, File sourceFile) throws ParserException {
// determining the mime type of the file ...
@ -113,6 +113,9 @@ implements Parser {
mimeType = match.getMimeType();
}
// to avoid loops we have to test if the mimetype has changed ...
if (this.getSupportedMimeTypes().containsKey(mimeType)) return null;
plasmaParser theParser = new plasmaParser();
return theParser.parseSource(location,mimeType,sourceFile);
}
@ -123,8 +126,8 @@ implements Parser {
}
}
public plasmaParserDocument parse(URL location, String mimeType,
InputStream source) throws ParserException {
public plasmaParserDocument parse(URL location, String mimeType,
InputStream source) throws ParserException {
File dstFile = null;
try {
dstFile = File.createTempFile("mimeTypeParser",".tmp");
@ -136,14 +139,14 @@ implements Parser {
if (dstFile != null) {dstFile.delete();}
}
}
public java.util.Hashtable getSupportedMimeTypes() {
return mimeTypeParser.SUPPORTED_MIME_TYPES;
}
public void reset() {
}
public java.util.Hashtable getSupportedMimeTypes() {
return mimeTypeParser.SUPPORTED_MIME_TYPES;
}
public void reset() {
// Nothing todo here at the moment
}
}
}

@ -1103,7 +1103,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
prop.put("results_" + i + "_description", descr);
prop.put("results_" + i + "_url", urlstring);
prop.put("results_" + i + "_urlname", urlname);
prop.put("results_" + i + "_date", dateString(urlentry.moddate()));
prop.put("results_" + i + "_date", dateString(urlentry.moddate()));
prop.put("results_" + i + "_size", Long.toString(urlentry.size()));
i++;
}
}

Loading…
Cancel
Save