public static String getBaseURL(final HttpServletRequest request){
String baseUrl = null;
try{
int port = request.getServerPort();
String scheme = request.getScheme();
String server = request.getServerName();
String contextPath = request.getContextPath();
baseUrl = scheme + "://" + server + ":" + port + contextPath + "/";
}catch (Exception e) {
log.error(e.getMessage(), e);
}
return baseUrl;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment