ServletContextPath can start with servletPath, now it's taking into consideration while determinate contextIndex.

This commit is contained in:
petromykhailysyn 2016-01-26 16:29:16 +02:00
parent c855fc5365
commit 83823aad35
1 changed files with 3 additions and 7 deletions

View File

@ -69,16 +69,12 @@ public class IncomingRequestAddressStrategy implements IServerAddressStrategy {
contextIndex = requestUrl.indexOf(requestPath, startOfPath); contextIndex = requestUrl.indexOf(requestPath, startOfPath);
} }
} else { } else {
contextIndex = requestUrl.indexOf(servletPath, startOfPath); //servletContextPath can start with servletPath
contextIndex = requestUrl.indexOf(servletPath + "/", startOfPath);
} }
String fhirServerBase; String fhirServerBase;
int length; int length = contextIndex + servletPath.length();
if (servletContextPath.length() == 0 || servletContextPath.equals("/")) {
length = contextIndex + servletPath.length();
} else {
length = contextIndex + servletPath.length() + servletContextPath.length();
}
if (length > requestUrlLength) { if (length > requestUrlLength) {
length = requestUrlLength; length = requestUrlLength;
} }