NIHVIVO-1380 On individual page, add rdf link tag for discoverable rdf

This commit is contained in:
rjy7 2011-01-10 22:19:35 +00:00
parent dc27a74a8a
commit be8930ea5c
3 changed files with 24 additions and 11 deletions

View file

@ -331,7 +331,8 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
return map; return map;
} }
// Add variables that should be available only to the page's root map, not to the body. // Add variables that are needed to generate the page template (they will also be accessible
// to the body template).
// RY This is protected instead of private so FreeMarkerComponentGenerator can access. // RY This is protected instead of private so FreeMarkerComponentGenerator can access.
// Once we don't need that (i.e., jsps have been eliminated) we can make it private. // Once we don't need that (i.e., jsps have been eliminated) we can make it private.
protected Map<String, Object> getPageTemplateValues(VitroRequest vreq) { protected Map<String, Object> getPageTemplateValues(VitroRequest vreq) {

View file

@ -121,13 +121,15 @@ public class IndividualController extends FreemarkerHttpServlet {
body.put("relatedSubject", getRelatedSubject(vreq)); body.put("relatedSubject", getRelatedSubject(vreq));
IndividualTemplateModel ind = getIndividualTemplateModel(vreq, individual); body.put("headContent", getRdfLinkTag(individual));
IndividualTemplateModel itm = getIndividualTemplateModel(vreq, individual);
/* We need to expose non-getters in displaying the individual's property list, /* We need to expose non-getters in displaying the individual's property list,
* since it requires calls to methods with parameters. * since it requires calls to methods with parameters.
* This is still safe, because we are only putting BaseTemplateModel objects * This is still safe, because we are only putting BaseTemplateModel objects
* into the data model: no real data can be modified. * into the data model: no real data can be modified.
*/ */
body.put("individual", getNonDefaultBeansWrapper(BeansWrapper.EXPOSE_SAFE).wrap(ind)); body.put("individual", getNonDefaultBeansWrapper(BeansWrapper.EXPOSE_SAFE).wrap(itm));
body.put("localName", new IndividualLocalNameMethod()); body.put("localName", new IndividualLocalNameMethod());
@ -192,6 +194,14 @@ public class IndividualController extends FreemarkerHttpServlet {
return map; return map;
} }
//<link rel="alternate" type="application/rdf+xml" href="http://vivo.cornell.edu/individual/n337/n337.rdf" />
private String getRdfLinkTag(Individual individual) {
String href = individual.getURI() + "/" + individual.getLocalName() + ".rdf";
String linkTag = "<link rel=\"alternate\" type=\"application/rdf+xml\" href=\"" +
href + "\" /> ";
return linkTag;
}
private IndividualTemplateModel getIndividualTemplateModel(VitroRequest vreq, Individual individual) private IndividualTemplateModel getIndividualTemplateModel(VitroRequest vreq, Individual individual)
throws ServletException, IOException { throws ServletException, IOException {

View file

@ -9,3 +9,5 @@
<#include "stylesheets.ftl"> <#include "stylesheets.ftl">
<#include "headScripts.ftl"> <#include "headScripts.ftl">
${headContent!}