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 Using https in java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using https in java application " Watch "Using https in java application " New topic
Author

Using https in java application

Abhisar Singh
Greenhorn

Joined: Aug 02, 2006
Posts: 16
Hi,

Can I get a simple code code which sends and recive data using HTTPS....
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

Application software transmittedHTTPS is the same as HTTP. The difference is on the server level, not the application level, there's no code to demonstrate this unless you're programming a server itself.


My Blog: Down Home Country Coding with Scott Selikoff
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
In the simplest case, just use javax.net.ssl.HttpsURLConnection instead of java.net.HttpURLConnection, and you should be good to go. Plenty of examples can be found using your trusted friend Google, in particular the very first link.
[ August 22, 2006: Message edited by: Ulf Dittmer ]
Abhisar Singh
Greenhorn

Joined: Aug 02, 2006
Posts: 16
Hi thanks Scott Selikoff

Ok say If have a simple HTML form which is sending data to a servlet.. How can I tell server to user HTTPS to transmit that data....
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

Use a "https" in the url to the servlet.
Abhisar Singh
Greenhorn

Joined: Aug 02, 2006
Posts: 16
thanks Ulf Dittmer & Scott Selikoff
amarnath nalumachu
Greenhorn

Joined: Feb 10, 2005
Posts: 10
Try HttpClient from Apache Commons project...It is more advanced and easier that URLConnection ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using https in java application