From 76b46459a13dea2af1294a85d57c3fd2bc39a5a8 Mon Sep 17 00:00:00 2001 From: Bruno Nocera Zanette <brunonzanette@gmail.com> Date: Tue, 10 Jun 2014 21:45:43 -0300 Subject: [PATCH] Change RSSFeed's Item's URLs to use IframeURL Change RSSFeed's Item's URLs to use IframeURL --- build.properties | 3 ++ dspace/config/dspace.cfg | 3 ++ .../org/dspace/app/util/SyndicationFeed.java | 33 ++++++++++++++++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index c38d73c..b054143 100644 --- a/build.properties +++ b/build.properties @@ -33,6 +33,9 @@ dspace.baseUrl = http://dspacesnj.c3sl.ufpr.br:8080 # DSpace base host URL for mobile access. Include port number etc. dspace.baseMobileUrl = http://m.dspacesnj.c3sl.ufpr.br:8080 +# Base URL of the server hosting the iframe +dspace.iframeBaseURL = http://participatorio.juventude.gov.br/biblioteca + # Name of the site dspace.name = Biblioteca Digital do Participatório - Observatório Participativo da Juventude diff --git a/dspace/config/dspace.cfg b/dspace/config/dspace.cfg index d98f3b7..de8c3bf 100644 --- a/dspace/config/dspace.cfg +++ b/dspace/config/dspace.cfg @@ -46,6 +46,9 @@ dspace.mobileUrl = ${dspace.baseMobileUrl}/xmlui # Name of the site dspace.name = ${dspace.name} +# Base URL of the server hosting the iframe +dspace.iframeBaseURL = ${dspace.iframeBaseURL} + # Default language for metadata values default.language = ${default.language} diff --git a/dspace/modules/additions/src/main/java/org/dspace/app/util/SyndicationFeed.java b/dspace/modules/additions/src/main/java/org/dspace/app/util/SyndicationFeed.java index b83ce3f..12ed245 100644 --- a/dspace/modules/additions/src/main/java/org/dspace/app/util/SyndicationFeed.java +++ b/dspace/modules/additions/src/main/java/org/dspace/app/util/SyndicationFeed.java @@ -173,7 +173,7 @@ public class SyndicationFeed { defaultTitle = ConfigurationManager.getProperty("dspace.name"); feed.setDescription(localize(labels, MSG_FEED_DESCRIPTION)); - objectURL = resolveURL(request, null); + objectURL = resolveIframeURL(request, null); logoURL = ConfigurationManager.getProperty("webui.feed.logo.url"); } else @@ -201,7 +201,7 @@ public class SyndicationFeed podcastFeed = true; } } - objectURL = resolveURL(request, dso); + objectURL = resolveIframeURL(request, dso); if (logo != null) { logoURL = urlOfBitstream(request, logo); @@ -244,7 +244,7 @@ public class SyndicationFeed SyndEntry entry = new SyndEntryImpl(); entries.add(entry); - String entryURL = resolveURL(request, item); + String entryURL = resolveIframeURL(request, item); entry.setLink(entryURL); entry.setUri(entryURL); @@ -562,7 +562,33 @@ public class SyndicationFeed * @return */ private String baseURL = null; // cache the result for null + private String iframeBaseURL = null; // cache the result for null + private String resolveIframeURL(HttpServletRequest request, DSpaceObject dso) + { + // If no object given then just link to the whole repository, + // since no offical handle exists so we have to use local resolution. + if (dso == null) + { + if (iframeBaseURL == null) + { + if (request == null) + { + iframeBaseURL = ConfigurationManager.getProperty("dspace.url"); + } + else + { + iframeBaseURL = ConfigurationManager.getProperty("dspace.iframeBaseURL"); + iframeBaseURL += "/" + "#" + request.getContextPath(); + } + } + return iframeBaseURL; + } + + // return a link to handle in repository + return resolveIframeURL(request, null) + "/handle/" + dso.getHandle(); + } + private String resolveURL(HttpServletRequest request, DSpaceObject dso) { // If no object given then just link to the whole repository, @@ -612,4 +638,3 @@ public class SyndicationFeed return (dcv.length > 0) ? dcv[0].value : null; } } - -- GitLab