using URLHttpsConnection

Posted on 2001-08-14
Medium Priority
Last Modified: 2013-11-24

where can I find source codes to do SSL session for servlets  using URLHttpsConnection.

Presently I am using URLHttpConnection to access and return data in a servlet.

How can I get it SSL enabled.
Question by:TLTEO
  • 4
  • 3
LVL 92

Expert Comment

ID: 6387039
Grab JSSE from Sun it supports SSL:

Author Comment

ID: 6389039
they don't have the examples really, on URLHttpsConnection.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 92

Expert Comment

ID: 6390608
If your using JSSE then it's all transparent. You just specify the (https) url you require and use URLConnection the same as you would for standard http.

URL secure = new URL("https://tlteo.com/my.html");
URLConnection conn = secure.openConnection();

Author Comment

ID: 6393931
yeap i know,, but I am using apache with tomcat, and I dont use mod_ssl.  I am trying to use jsse to create a SSL session.

Seems like the crucial part is the PrintWriter out PrintWriter out;
            out = res.getWriter();

How can I link
         PrintWriter out = new PrintWriter(
                      new BufferedWriter(
                      new OutputStreamWriter(

         SSLSocket socket =
          (SSLSocket)factory.createSocket(tunnel, host, port, true);


LVL 92

Expert Comment

ID: 6394895
Are you trying to write SSL?
Sorry I thought you were trying to read SSL.
LVL 92

Accepted Solution

objects earned 120 total points
ID: 6394905

Author Comment

ID: 6418675
it is tuff writing this using URLHttpsConnection.  But anyway, I am trying to install a self signed cert into the system and test it.  more problems to come . Cheers

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question