Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom context path configuation option #4011

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.apache.jena.query.ResultSet;

import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.config.ContextPath;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
Expand Down Expand Up @@ -132,7 +133,7 @@ private Map<String, String> generateQrData(Individual individual, VitroRequest v
qrData.put("externalUrl", externalUrl);

String individualUri = individual.getURI();
String contextPath = vreq.getContextPath();
String contextPath = ContextPath.getPath(vreq);
qrData.put("exportQrCodeUrl", contextPath + "/qrcode?uri=" + UrlBuilder.urlEncode(individualUri));

qrData.put("aboutQrCodesUrl", contextPath + "/about_qrcode");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.config.ContextPath;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.LocalNamespaceClassUtils;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
Expand Down Expand Up @@ -81,8 +82,8 @@ protected ResponseValues processRequest(VitroRequest vreq) {

//Check if existing local namespaces

data.put("formUrl", vreq.getContextPath() + EDIT_FORM);
data.put("cancelUrl", vreq.getContextPath() + REDIRECT_PAGE);
data.put("formUrl", ContextPath.getPath(vreq) + EDIT_FORM);
data.put("cancelUrl", ContextPath.getPath(vreq) + REDIRECT_PAGE);

//if no local namespaces, then provide message to display
//if existing namespace(s), then check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.jena.rdf.model.Model;

import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest;
import edu.cornell.mannlib.vitro.webapp.config.ContextPath;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.query.QuerySolution;

import edu.cornell.mannlib.vitro.webapp.config.ContextPath;
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
Expand All @@ -41,7 +41,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
if (requestURI != null) {
if (requestURI.contains("robots.txt")) {
String robotsPath = getServletContext().getRealPath("/robots.txt");
String contextPath = request.getContextPath();
String contextPath = ContextPath.getPath(request);

StringBuilder builder = new StringBuilder("Sitemap: ");
builder.append(getSchemeAndServer(request));
Expand Down
4 changes: 4 additions & 0 deletions home/src/main/resources/config/example.runtime.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#
Vitro.defaultNamespace = http://vivo.mydomain.edu/individual/

# In case VIVO is behind proxy you might want to avoid redirects by overriding
# context path to empty string or other custom value
# context.path=

#
# The email address of the root user for the VIVO application. The password
# for this user is initially set to "rootPassword", but you will be asked to
Expand Down
Loading