This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I want to implement SSL on the login part of my application only (running on Tomcat). I've managed to get this working but can't get the application to switch back to non-SSL mode i.e. to http after the login screen. I've tried a few different things and had a good search on the web but can't find a solution.
At present, the application's web.xml looks like this:
I only want SSL security on the logon.html page. This works i.e. when the user gets to http://localhost:8080/myApp/logon.html he is re-directed to port 8443 and prompted to accept the certificate. However, after a successful login, as the user navigates through the application, the protocol is still https and he is still connecting through port 8443. I want it so that after he goes through the login process that he is directed back to port 8080 and is using the http protocol.
My understanding is that it should be possible to do this. Any help appreciated.
What you're seeing is that your confidential guarantee is doing it's job. It's redirecting on login, but there's no "not confidential" guarantee. So, the servlet container understands from your web.xml that it must redirect to https when login.html is accessed, but there's nothing to tell it to go back. However, if your login.html form goes to say ... /LoginServlet, you could redirect from there to http:// ... landingpage.jsp or something like that, and that should do the trick. In other words you have to tell it to go back to http once, but after that, everything will be relative.