Update WebContext.java

This commit is contained in:
MaxKey 2021-04-25 20:19:07 +08:00
parent 4b696f8745
commit cfbc7520b0

View File

@ -204,19 +204,21 @@ public final class WebContext {
_logger.trace("ServerName " + httpServletRequest.getServerName());
String httpContextPath ="";
if (httpServletRequest.getServerName().matches(ipAddressRegex)
||httpServletRequest.getServerName().equalsIgnoreCase("localhost")) {
String scheme = httpServletRequest.getScheme().toLowerCase();
httpContextPath = scheme + "://"+httpServletRequest.getServerName();
httpContextPath = httpServletRequest.getScheme().toLowerCase()
+ "://"+httpServletRequest.getServerName();
httpContextPath += httpServletRequest.getContextPath();
}else {
httpContextPath = applicationConfig.getServerName() ;
}
int port = httpServletRequest.getServerPort();
if(!(port==80 || port==443)){
httpContextPath += ":"+port;
}
httpContextPath += httpServletRequest.getContextPath() + "";
}else {
httpContextPath = applicationConfig.getServerName() + httpServletRequest.getContextPath() + "";
}
_logger.trace("httpContextPath " + httpContextPath);
return httpContextPath;