How to force HTTPS use in a Java Web Application

If you want to force the users to always use https:// even if they typed in http:// url, Applying Security Constraint in Web.xml can help.

              <description>Do HTTPS redirect so that the connection is secured</description>

The above constraint re-directs the user to https URL.