Add URL localisation option to RSS feed feature

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1356 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Scott Yeadon
2005-11-04 04:43:05 +00:00
parent 7971300090
commit 02002465e8
2 changed files with 10 additions and 2 deletions

View File

@@ -713,6 +713,8 @@ dstat-report-monthly
set the value of this property to that format, selecting only from the list of canonical names provided. If you wish multiple formats, set the value of this property to that format, selecting only from the list of canonical names provided. If you wish multiple formats,
set the value to a comma-separated list of canonical names. Each format will appear as a distinct icon and link set the value to a comma-separated list of canonical names. Each format will appear as a distinct icon and link
in the community and collection home page, as well as an 'autodiscovery' link in the page header.</p> in the community and collection home page, as well as an 'autodiscovery' link in the page header.</p>
<p><code>webui.feed.localresolve = false</code></p>
<p>By default, the RSS feed will return global handle server-based URLs to items, collections and communities (e.g. http://hdl.handle.net/123456789/1). This means if you have not registered your DSpace installation with the CNRI Handle Server (e.g. development or testing instance) the URLs returned by the feed will return an error if accessed. Setting <code>webui.feed.localresolve = true</code> will result in the RSS feed returning localised URLs (e.g. http://myserver.myorg/handle/123456789/1). If <code>webui.feed.localresolve</code> is set to <code>false</code> or not present the default global handle URL form is used.</p>
<hr> <hr>
<address> <address>

View File

@@ -257,7 +257,9 @@ public class FeedServlet extends DSpaceServlet
throws IOException, SQLException throws IOException, SQLException
{ {
// container-level elements // container-level elements
String objectUrl = HandleManager.getCanonicalForm(dso.getHandle()); String objectUrl = ConfigurationManager.getBooleanProperty("webui.feed.localresolve")
? HandleManager.resolveToURL(context, dso.getHandle())
: HandleManager.getCanonicalForm(dso.getHandle());
String dspaceUrl = ConfigurationManager.getProperty("dspace.url"); String dspaceUrl = ConfigurationManager.getProperty("dspace.url");
String type = null; String type = null;
String description = null; String description = null;
@@ -336,11 +338,15 @@ public class FeedServlet extends DSpaceServlet
*/ */
private com.sun.syndication.feed.rss.Item itemFromDSpaceItem(Context context, private com.sun.syndication.feed.rss.Item itemFromDSpaceItem(Context context,
Item dspaceItem) Item dspaceItem)
throws SQLException
{ {
com.sun.syndication.feed.rss.Item rssItem = com.sun.syndication.feed.rss.Item rssItem =
new com.sun.syndication.feed.rss.Item(); new com.sun.syndication.feed.rss.Item();
String itHandle = HandleManager.getCanonicalForm(dspaceItem.getHandle()); String itHandle = ConfigurationManager.getBooleanProperty("webui.feed.localresolve")
? HandleManager.resolveToURL(context, dspaceItem.getHandle())
: HandleManager.getCanonicalForm(dspaceItem.getHandle());
rssItem.setLink(itHandle); rssItem.setLink(itHandle);
String title = getDC(dspaceItem, "title", null, Item.ANY); String title = getDC(dspaceItem, "title", null, Item.ANY);