title: java- using a filter to check remote address
body: <p>What would be the best approach to detect if a web application is accessed locally?<br>
  I am interested in checking this in a <strong>filter</strong> (<code>javax.servlet.Filter</code>).<br>
  I could check the <code>ServletRequest#getRemoteAddr()</code> if it is <code>127.0.0.1</code> but if it is running in a IPv6 machine, the address would be <code>0:0:0:0:0:0:0:1</code>.<br>
  Are there any other pitfalls I should be aware of, or if I just check for these 2 string patterns, I would be ok?  </p>
  
  <p>Thanks</p>