This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JSP and the fly likes how to redirect from https to http Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to redirect from https to http" Watch "how to redirect from https to http" New topic
Author

how to redirect from https to http

Jonh Smith
Ranch Hand

Joined: Mar 18, 2010
Posts: 39
Hello

I have a servlet protected with <transport-guarantee>CONFIDENTIAL</transport-guarantee>, which correctly makes glassfish generate an automatic redirection response to the https port, when i use that servlet's mapped url in the browser. However, once there, any redirection to some unprotected resource keeps using the htpps protocol, not http and i don't want that. How can i do a response.sendRedirect(/*WHAT DO I PUT HERE?*/) that acomplishes this ? That is, if i use



the server response redirect location is for
https://localhost:8082/mywebapp/myurl,

instead of
http://localhost:/8081/mywebapp/myurl

Thank you
Rohan kanade
Ranch Hand

Joined: Oct 22, 2009
Posts: 106


SCJP 1.6 ,SCWCD 5
Jonh Smith
Ranch Hand

Joined: Mar 18, 2010
Posts: 39
I wasn't very happy with hard-wiring the domain name so googled around and made a small change to your suggestion:

Thank you very much for your help!
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: how to redirect from https to http
 
It's not a secret anymore!