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
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Redirecting to HTTPS" Watch "Redirecting to HTTPS" New topic
Author

Redirecting to HTTPS

Nelo Angelo
Ranch Hand

Joined: Jul 25, 2011
Posts: 44

Hello everyone,

I am trying to create an example that uses HTTPS connection. I have successfully configured a custom certificate following the steps given in Tomcat 6.0 documentation. A https://localhost:8443/ successfully opens the Tomcat index page.

I am unable to configure a page/servlet to open in HTTPS. Would anyone please suggest me the steps to configure a webapp to automatically redirect itself into a HTTPS connection.


I love java but she hates me... :'(
Nelo Angelo
Ranch Hand

Joined: Jul 25, 2011
Posts: 44

Here's the example I'm trying...

usingHttpsForm.html




UsingHttpsServlet.java



web.xml



=======
Error:
=======

I get a Page Cannot be Displayed while running the web-app or executing usingHttpsForm.html.

=========
SCREENS
=========

[Thumb - 2.jpg]
 Filename 2.jpg [Disk] Download
 Description executing usingHttpsForm.html
 Filesize 85 Kbytes
 Downloaded:  3 time(s)

[Thumb - 1.jpg]
 Filename 1.jpg [Disk] Download
 Description executing the web-app
 Filesize 84 Kbytes
 Downloaded:  1 time(s)

Ankush Kaundal
Greenhorn

Joined: May 12, 2011
Posts: 14
Have you configured your server.xml to allow the application to run using HTTPS??
and also you have to give keystore and keypass attributes in server.xml.
Nelo Angelo
Ranch Hand

Joined: Jul 25, 2011
Posts: 44

Hi,

Thanks for the reply. Yes, I have successfully configured SSL in Tomcat and all the necessary changes to the server.xml have been done.
Here's the copy of my server.xml document..

server.xml

Ankush Kaundal
Greenhorn

Joined: May 12, 2011
Posts: 14
I think in this case the server is not picking up the path of the keystore file, maybe you can put the file in some other location on your hard drive and try giving the absolute path.
Nelo Angelo
Ranch Hand

Joined: Jul 25, 2011
Posts: 44

Thanks for the reply.

The problem is now resolved. I created another server in Eclipse and it copied the server.xml of Tomcat!!! So, finally, SSL working with Eclipse. Thanks again for the replies.
 
IntelliJ Java IDE
 
subject: Redirecting to HTTPS
 
Threads others viewed
configuring https with tomcat - issue
JNDI with Tomcat
steps for connecting tomcat with oracle database
configure ssl problem
Tomcat SSL issue with "user-data-constraint"
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture