aspose 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
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
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    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: 41489
    
  53
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 ]

Ping & DNS - my free Android networking tools app
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
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    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 ...
 
Don't get me started about those stupid light bulbs.
 
subject: Using https in java application