get host name from port code example Example: get host from request object java request.getRequestURL().toString().replace(request.getRequestURI(), "")