static public boolean isFromLocalhost ( HttpServletRequest request ) { String addr = request . getRemoteAddr ( ) ; return "0:0:0:0:0:0:0:1" . equals ( addr ) || "::1" . equals ( addr ) || ( addr != null && addr . startsWith ( "127." ) ) ; }
Check to see if the request is from localhost