title: get list of origin urls from HttpServletRequest
body: <p>I need to only allow a list of sites to embed our site. </p>
  
  <pre><code>    public boolean matches(HttpServletRequest request) {
      String requestReferer = request.getHeader("Referer");
  
      for (String s : whiteList) {
          if (requestReferer.toLowerCase().contains(s))
              return true;
      }
      return false;
  }
  </code></pre>
  
  <p>I am getting the "Referer" from the request header which gives the complete URL of the origin: <a href="http://somesite.com/something/something" rel="nofollow">http://somesite.com/something/something</a></p>
  
  <p>The above code works fine. However, is there a way to just get the host name from the HttpServletRequest object rather than using "Referer"?
  I mean is there a way to just get "somesite.com" from the HttpServletRequest object.</p>