Skip to content

Commit

Permalink
*) adding image tag into rss template
Browse files Browse the repository at this point in the history
*) 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
  • Loading branch information
theli committed May 25, 2005
1 parent 6f09251 commit 74eb21f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
8 changes: 7 additions & 1 deletion htroot/index.java
Expand Up @@ -244,7 +244,13 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve

// 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) {
Expand Down
6 changes: 6 additions & 0 deletions htroot/index.rss
@@ -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>
Expand Down
1 change: 1 addition & 0 deletions httpd.mime
Expand Up @@ -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
Expand Down
35 changes: 19 additions & 16 deletions source/de/anomic/plasma/parser/mimeType/mimeTypeParser.java
Expand Up @@ -65,7 +65,7 @@
public class mimeTypeParser
extends AbstractParser
implements Parser {

/**
* a list of mime types that are supported by this parser class
* @see #getSupportedMimeTypes()
Expand All @@ -88,10 +88,10 @@ public class mimeTypeParser
"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 ...
Expand All @@ -113,6 +113,9 @@ public plasmaParserDocument parse(URL location, String mimeType, File sourceFile
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);
}
Expand All @@ -123,8 +126,8 @@ public plasmaParserDocument parse(URL location, String mimeType, File sourceFile
}
}

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");
Expand All @@ -136,14 +139,14 @@ public plasmaParserDocument parse(URL location, String mimeType,
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
}

}
}
3 changes: 2 additions & 1 deletion source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -1103,7 +1103,8 @@ public serverObjects searchFromLocal(Set querywords, String order1, String order
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++;
}
}
Expand Down

0 comments on commit 74eb21f

Please sign in to comment.