wood burning stoves 2.0*
The moose likes Servlets and the fly likes Redirecting to HTTPS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirecting to HTTPS" Watch "Redirecting to HTTPS" New topic
Author

Redirecting to HTTPS

Saikiran Kochi
Greenhorn

Joined: Mar 25, 2008
Posts: 1
Hi,

How to make secure my page by redirecting to "https" from "http" request?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You can do it declaratively with security-constraint entries in web.xml or
you can do it programmatically by reading the isSecure property from the request object and redirecting to the secure version of you page yourself.

Filters are a nice place to put this code.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42264
    
  64
Welcome to JavaRanch.

Adding a security constraint like the following to your web.xml will require HTTPS for all URLs:


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redirecting to HTTPS