Skip to content

Commit

Permalink
RESTful Forward Rule: Replace Target Base URL and Keycloak Server ID …
Browse files Browse the repository at this point in the history
…by Web Application name #1924
  • Loading branch information
vrindanayak committed Apr 15, 2019
1 parent 8c5b17d commit 81b7f40
Showing 1 changed file with 17 additions and 15 deletions.
Expand Up @@ -89,21 +89,23 @@ public void forward(
arcAE.findRSForwardRules(rsOp, request).forEach(rule -> {
try {
WebApplication webApplication = iWebAppCache.findWebApplication(rule.getWebAppName());
String serviceURL = webApplication.getServiceURL().toString();
String targetURI = serviceURL + (serviceURL.endsWith("rs/") ? "" : "/") + appendURI;
if (!targetURI.equals(request.getRequestURL().toString())) {
if (rsOp == RSOperation.CreatePatient)
targetURI += patientID;
rsClient.scheduleRequest(
getMethod(rsOp),
targetURI,
in,
webApplication.getKeycloakClientID(),
rule.isTlsAllowAnyHostname(),
rule.isTlsDisableTrustManager());
LOG.info("Forwarded {} {} from {}@{} using RSForward rule {} to device {}. Target URL is {}",
request.getMethod(), request.getRequestURI(), request.getRemoteUser(),
request.getRemoteHost(), rule, webApplication.getDevice().getDeviceName(), targetURI);
if (webApplication.containsServiceClass(WebApplication.ServiceClass.DCM4CHEE_ARC_AET)) {
String serviceURL = webApplication.getServiceURL().toString();
String targetURI = serviceURL + (serviceURL.endsWith("rs/") ? "" : "/") + appendURI;
if (!targetURI.equals(request.getRequestURL().toString())) {
if (rsOp == RSOperation.CreatePatient)
targetURI += patientID;
rsClient.scheduleRequest(
getMethod(rsOp),
targetURI,
in,
webApplication.getKeycloakClientID(),
rule.isTlsAllowAnyHostname(),
rule.isTlsDisableTrustManager());
LOG.info("Forwarded RSOperation {} {} {} from {}@{} using RSForward rule {} to device {}. Target URL is {}",
rsOp, request.getMethod(), request.getRequestURI(), request.getRemoteUser(),
request.getRemoteHost(), rule, webApplication.getDevice().getDeviceName(), targetURI);
}
}
} catch (Exception e) {
LOG.warn("Failed to apply RSForwardRule {} to {} {} from {}@{} for RSOperation {} :\n",
Expand Down

0 comments on commit 81b7f40

Please sign in to comment.