Server-side input validation and how to do it in Java