title: Check domain or IP that request came from?
body: <p>I have a servlet, is it possible to check if a request came from a specific domain, say "example.com"?</p>
  
  <pre><code>public abstract class MyServlet extends HttpServlet {
  
  public void doPost(HttpServletRequest req, HttpServletResponse resp) 
      throws ServletException, IOException 
  {
          if (didOriginateFrom("example.com", req)) {
              // ok to process
          }
      }
  }
  </code></pre>
  
  <p>I have one server that will offload some work to a secondary server (above), just want to make sure it only process requests that come from my primary server,</p>
  
  <p>Thanks</p>