In this article I will show how we can secure the application resources by converting the HTTP request to HTTPS request.
This is also known as Forcing the use of SSL.
A security constraint can be set up to force certain areas of your application (or your entire application) into SSL mode. This is useful if those resources will be used for confidential information, such as login details or the entry of credit card details.
To implement this we just have to make changes in web.xml by creating a <transport-guarantee element> in a <user-data-constraint> element.
<<Even this works well in JBoss and Weblogic >>
<!– Protect all resources –>
<!– All access to the application resources is going to SSL protected –>
[Note] On Tomcat Make sure your standard HttpConnector in server.xml has redirectPort=”YOUR_SSL_PORT”