[Yanel-commits] rev 28600 - in
public/yanel/contributions/realms/foaf: res-configs
src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf
michi at wyona.com
michi at wyona.com
Wed Nov 7 23:27:54 CET 2007
Author: michi
Date: 2007-11-07 23:27:53 +0100 (Wed, 07 Nov 2007)
New Revision: 28600
Modified:
public/yanel/contributions/realms/foaf/res-configs/map.rc-map
public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf/FOAFResource.java
Log:
rdf fixed
Modified: public/yanel/contributions/realms/foaf/res-configs/map.rc-map
===================================================================
--- public/yanel/contributions/realms/foaf/res-configs/map.rc-map 2007-11-07 22:21:05 UTC (rev 28599)
+++ public/yanel/contributions/realms/foaf/res-configs/map.rc-map 2007-11-07 22:27:53 UTC (rev 28600)
@@ -2,4 +2,5 @@
<rc-map>
<matcher pattern="/profiles/*.html" rcpath="/profile.yanel-rc"/>
+ <matcher pattern="/profiles/*.rdf" rcpath="/profile.yanel-rc"/>
</rc-map>
Modified: public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf/FOAFResource.java
===================================================================
--- public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf/FOAFResource.java 2007-11-07 22:21:05 UTC (rev 28599)
+++ public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf/FOAFResource.java 2007-11-07 22:27:53 UTC (rev 28600)
@@ -72,13 +72,21 @@
*/
public View getView(String viewId) {
View view = new View();
+ String path = getPath();
+
+
try {
+ if (path.lastIndexOf(".rdf") == path.length() - 4) {
+ view.setInputStream(getRDFAsInputStream());
+ view.setMimeType(getMimeType("rdf+xml"));
+ return view;
+ }
+
StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
sb.append("<wyona:foaf xmlns:wyona=\"http://www.wyona.org/foaf/1.0\">");
if (getRequest().getParameter("href") != null) {
sb.append("<wyona:third-party-source href=\"" + getRequest().getParameter("href") + "\"/>");
} else {
- String path = getPath();
sb.append("<wyona:source href=\"" + path.substring(0, path.lastIndexOf(".html")) + ".rdf\"/>");
}
// TODO: The following leads to errors if the RDF contains special characters!
@@ -151,7 +159,11 @@
return url.openConnection().getInputStream();
} else {
String path = getPath();
- return getProfilesRepository().getNode(path.substring(0, path.lastIndexOf(".html")) + ".rdf").getInputStream();
+ if (path.lastIndexOf(".rdf") == path.length() - 4) {
+ return getProfilesRepository().getNode(path).getInputStream();
+ } else {
+ return getProfilesRepository().getNode(path.substring(0, path.lastIndexOf(".html")) + ".rdf").getInputStream();
+ }
}
}
More information about the Yanel-commits
mailing list