File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets 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: 41017
    
  43
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
 
Consider Paul's rocket mass heater.
 
subject: Redirecting to HTTPS
 
Similar Threads
problem with prepared statement
Servlet and data security and authantication
How is jsessionId handled when moving from http --> https?
Tomcat session sharing - url rewrite and switching from http to https
how to redirect from HTTPS to HTTP