Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Tomcat and the fly likes Switching btw 2 protocols Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Switching btw 2 protocols" Watch "Switching btw 2 protocols" New topic

Switching btw 2 protocols

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3476

Hi all.
I know how to configure tomcat to use https protocol.
now, I want to develop the following application:
the user must type the following url to visit the application:
inside this page, I have the following link:
<a href="http://localhost:8443/context/register.jsp">Register</a>
the problem is :
how to configure tomcat to use https protocol (only) when the user clicks on register link (in this case , the port 8443).
I can make tomcat use https, but the problem is , it uses it for the whole
application ( I mean, https://localhost:8843/context/index.jsp)
which it is not the case in the real applications.
Any help is very appreciated..
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

are you configuring tomcat to 'use https' by setting transport-guarantee in web.xml for '/'?

That would result in requiring https for the 'whole' site, but you should be able to configure it on page-by-page basis.

Also, there's a much "simpler" way to do this, by simply modifying the link that takes you to the registration page. Make it :
<a href="https://localhost:8443/context/register.jsp">Register</a>

Then when that page is done, it can sendRedirect back to regular http:

I agree. Here's the link:
subject: Switching btw 2 protocols
Similar Threads
Servlet Context Virtual Sandbox
Apache + Tomcat 5.5.4 connector on WinXP
Tomcat SSL Context
How Tomcat Works book - development question
different port to different app