From 5701572e08301d3f4a7337f49cbb76775c482f74 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 13 Sep 2014 12:15:35 -0500 Subject: [PATCH] Fix url determination --- .../rest/server/IncomingRequestAddressStrategy.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java index 8e9cb2645df..0cae6bfe87a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java @@ -46,15 +46,23 @@ public class IncomingRequestAddressStrategy implements IServerAddressStrategy { requestPath = requestPath.substring(1); } + int startOfPath = requestUrl.indexOf("//"); + if (startOfPath != -1 && (startOfPath + 2) < requestUrl.length()) { + startOfPath = requestUrl.indexOf("/", startOfPath + 2); + } + if (startOfPath == -1) { + startOfPath = 0; + } + int contextIndex; if (servletPath.length() == 0) { if (requestPath.length() == 0) { contextIndex = requestUrl.length(); } else { - contextIndex = requestUrl.indexOf(requestPath); + contextIndex = requestUrl.indexOf(requestPath, startOfPath); } } else { - contextIndex = requestUrl.indexOf(servletPath); + contextIndex = requestUrl.indexOf(servletPath, startOfPath); } String fhirServerBase;