Dinesh Lingam
Dinesh Lingam

Reputation: 293

How to prevent HTTP and allow HTTPS?

How to check the URL is http or https through programmatically using HttpServlet. If the Url is http send message as Warning otherwise message as Allow.

How to prevent HTTP Url and allow HTTPS through programmatically.

Upvotes: 0

Views: 877

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

You can detect HTTPS inside a servlet via servletRequest.isSecure().

To force use of HTTPS, just configure secure Urls in your web.xml. The when users go to HTTP they will be redirected to HTTPS.

Upvotes: 1

Related Questions