title: How to get the domain name from the request in a Java servlet?
body: <p>If a single servlet serves data from two domains <code>example1.com</code> and <code>example2.com</code>, how do you retrieve the domain information from the request in a Java servlet?</p>
  
  <p>The purpose is to perform different actions depending on the domain.</p>