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.

      <security-constraint>
          <display-name>HTTPS-redirect</display-name>
          <web-resource-collection>
              <web-resource-name>secured-environments</web-resource-name>
              <description>Do HTTPS redirect so that the connection is secured</description>
              <url-pattern>/*</url-pattern>
          </web-resource-collection>
          <user-data-constraint>
              <transport-guarantee>CONFIDENTIAL</transport-guarantee>
          </user-data-constraint>
      </security-constraint>

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

Tagged , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

One Response to Complete Tutorial On Using SOAP-UI to Mock Web Service Request / Response

  1. Pingback: Twenty Differences Between SOAP and REST Webservice - Java and Android Programming Blog @ iCodeJava.com

Leave a Reply

Your email address will not be published. Required fields are marked *