diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java
index 34caa8c37..e3b8d6f85 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java
@@ -184,7 +184,7 @@ public class IndividualController extends FreemarkerHttpServlet {
private String getRdfLinkTag(IndividualTemplateModel itm) {
String linkTag = null;
- String linkedDataUrl = itm.getLinkedDataUrl();
+ String linkedDataUrl = itm.getRdfUrl(false);
if (linkedDataUrl != null) {
linkTag = " ";
@@ -200,10 +200,7 @@ public class IndividualController extends FreemarkerHttpServlet {
individual.setKeywords(iwDao.getKeywordsForIndividualByMode(individual.getURI(),"visible"));
individual.sortForDisplay();
- //setup highlighter for search terms
- //checkForSearch(vreq, individual);
-
- return new IndividualTemplateModel(individual, vreq, LoginStatusBean.getBean(vreq));
+ return new IndividualTemplateModel(individual, vreq);
}
// Determine whether the individual has a custom display template based on its class membership.
@@ -413,9 +410,9 @@ public class IndividualController extends FreemarkerHttpServlet {
private static Pattern TTL_REQUEST = Pattern.compile("^/individual/([^/]*)/\\1.ttl$");
private static Pattern HTML_REQUEST = Pattern.compile("^/display/([^/]*)$");
- private static Pattern RDF_PARAM = Pattern.compile("rdf");
- private static Pattern N3_PARAM = Pattern.compile("n3");
- private static Pattern TTL_PARAM = Pattern.compile("ttl");
+ public static final Pattern RDFXML_FORMAT = Pattern.compile("rdfxml");
+ public static final Pattern N3_FORMAT = Pattern.compile("n3");
+ public static final Pattern TTL_FORMAT = Pattern.compile("ttl");
/**
* @return null if this is not a linked data request, returns content type if it is a
@@ -428,15 +425,15 @@ public class IndividualController extends FreemarkerHttpServlet {
// Check for url param specifying format
String formatParam = (String) vreq.getParameter("format");
if (formatParam != null) {
- m = RDF_PARAM.matcher(formatParam);
+ m = RDFXML_FORMAT.matcher(formatParam);
if ( m.matches() ) {
return new ContentType(RDFXML_MIMETYPE);
}
- m = N3_PARAM.matcher(formatParam);
+ m = N3_FORMAT.matcher(formatParam);
if( m.matches() ) {
return new ContentType(N3_MIMETYPE);
}
- m = TTL_PARAM.matcher(formatParam);
+ m = TTL_FORMAT.matcher(formatParam);
if( m.matches() ) {
return new ContentType(TTL_MIMETYPE);
}
@@ -571,27 +568,6 @@ public class IndividualController extends FreemarkerHttpServlet {
return newModel;
}
-
-
- private void checkForSearch(HttpServletRequest req, Individual ent) {
- if (req.getSession().getAttribute("LastQuery") != null) {
- VitroQueryWrapper qWrap = (VitroQueryWrapper) req.getSession()
- .getAttribute("LastQuery");
- if (qWrap.getRequestCount() > 0 && qWrap.getQuery() != null) {
- VitroQuery query = qWrap.getQuery();
-
- //set query text so we can get it in JSP
- req.setAttribute("querytext", query.getTerms());
-
- //setup highlighting for output
- StringProcessorTag.putStringProcessorInRequest(req, qWrap.getHighlighter());
-
- qWrap.setRequestCount(qWrap.getRequestCount() - 1);
- } else {
- req.getSession().removeAttribute("LastQuery");
- }
- }
- }
private Pattern badrequest= Pattern.compile(".*([&\\?=]|\\.\\.).*");
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java
index 99282f914..a9ae7cdb1 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java
@@ -2,7 +2,8 @@
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -31,10 +32,10 @@ public class IndividualTemplateModel extends BaseTemplateModel {
protected LoginStatusBean loginStatusBean = null;
private EditingPolicyHelper policyHelper = null;
- public IndividualTemplateModel(Individual individual, VitroRequest vreq, LoginStatusBean loginStatusBean) {
+ public IndividualTemplateModel(Individual individual, VitroRequest vreq) {
this.individual = individual;
this.vreq = vreq;
- this.loginStatusBean = loginStatusBean;
+ this.loginStatusBean = LoginStatusBean.getBean(vreq);
// Needed for getting portal-sensitive urls. Remove if multi-portal support is removed.
this.urlBuilder = new UrlBuilder(vreq.getPortal());
@@ -80,14 +81,12 @@ public class IndividualTemplateModel extends BaseTemplateModel {
return thumbUrl == null ? null : getUrl(thumbUrl);
}
- public String getLinkedDataUrl() {
- String defaultNamespace = vreq.getWebappDaoFactory().getDefaultNamespace();
- String uri = getUri();
- return uri.startsWith(defaultNamespace) ? uri + "/" + getLocalName() + ".rdf" : null;
+ public String getRdfUrl() {
+ return getRdfUrl(true);
}
- // Used to create a link to a display of the individual's rdf.
- public String getRdfUrl() {
+ // Used to create a link to generate the individual's rdf.
+ public String getRdfUrl(boolean checkExternalNamespaces) {
String individualUri = getUri();
String profileUrl = getProfileUrl();
@@ -97,7 +96,7 @@ public class IndividualTemplateModel extends BaseTemplateModel {
// Individuals in the default namespace
// e.g., http://vivo.cornell.edu/individual/n2345/n2345.rdf
- // where default namespace = http://vivo.cornell.edu/individual/
+ // where default namespace = http://vivo.cornell.edu/individual/
String defaultNamespace = vreq.getWebappDaoFactory().getDefaultNamespace();
if (defaultNamespace.equals(namespace)) {
return profileUrl + "/" + getLocalName() + ".rdf";
@@ -105,12 +104,15 @@ public class IndividualTemplateModel extends BaseTemplateModel {
// An RDF url is not defined for an externally linked namespace. The data does not reside
// in the current system, and the external system may not accept a request for rdf.
- if (vreq.getWebappDaoFactory().getApplicationDao().isExternallyLinkedNamespace(namespace)) {
+ if (checkExternalNamespaces && vreq.getWebappDaoFactory()
+ .getApplicationDao()
+ .isExternallyLinkedNamespace(namespace)) {
return null;
}
- // http://some.other.namespace/n2345?format=application/rdf+xml
- return UrlBuilder.addParams(profileUrl, "format", "rdf");
+ // http://some.other.namespace/n2345?format=rdfxml
+ // ** RY Not sure it is correct to return this for the element
+ return UrlBuilder.addParams(profileUrl, "format", "rdfxml");
}