mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-06 17:08:29 +08:00
Update WebContext.java
This commit is contained in:
parent
4b696f8745
commit
cfbc7520b0
@ -204,20 +204,22 @@ public final class WebContext {
|
|||||||
_logger.trace("ServerName " + httpServletRequest.getServerName());
|
_logger.trace("ServerName " + httpServletRequest.getServerName());
|
||||||
|
|
||||||
String httpContextPath ="";
|
String httpContextPath ="";
|
||||||
|
|
||||||
if (httpServletRequest.getServerName().matches(ipAddressRegex)
|
if (httpServletRequest.getServerName().matches(ipAddressRegex)
|
||||||
||httpServletRequest.getServerName().equalsIgnoreCase("localhost")) {
|
||httpServletRequest.getServerName().equalsIgnoreCase("localhost")) {
|
||||||
String scheme = httpServletRequest.getScheme().toLowerCase();
|
httpContextPath = httpServletRequest.getScheme().toLowerCase()
|
||||||
httpContextPath = scheme + "://"+httpServletRequest.getServerName();
|
+ "://"+httpServletRequest.getServerName();
|
||||||
int port = httpServletRequest.getServerPort();
|
httpContextPath += httpServletRequest.getContextPath();
|
||||||
if(!(port==80 || port==443)){
|
|
||||||
httpContextPath += ":"+port;
|
|
||||||
}
|
|
||||||
httpContextPath += httpServletRequest.getContextPath() + "";
|
|
||||||
}else {
|
}else {
|
||||||
httpContextPath = applicationConfig.getServerName() + httpServletRequest.getContextPath() + "";
|
httpContextPath = applicationConfig.getServerName() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int port = httpServletRequest.getServerPort();
|
||||||
|
if(!(port==80 || port==443)){
|
||||||
|
httpContextPath += ":"+port;
|
||||||
|
}
|
||||||
|
|
||||||
|
httpContextPath += httpServletRequest.getContextPath() + "";
|
||||||
|
|
||||||
_logger.trace("httpContextPath " + httpContextPath);
|
_logger.trace("httpContextPath " + httpContextPath);
|
||||||
return httpContextPath;
|
return httpContextPath;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user