Solved

using URLHttpsConnection

Posted on 2001-08-14
8
483 Views
Last Modified: 2013-11-24
Hi

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.
0
Comment
Question by:TLTEO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6387039
Grab JSSE from Sun it supports SSL:
http://java.sun.com/products/jsse/
0
 

Author Comment

by:TLTEO
ID: 6389039
they don't have the examples really, on URLHttpsConnection.
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 92

Expert Comment

by:objects
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();
...
0
 

Author Comment

by:TLTEO
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;
     
            res.setContentType("text/html");
            out = res.getWriter();

How can I link
 
socket.startHandshake();
         PrintWriter out = new PrintWriter(
                      new BufferedWriter(
                      new OutputStreamWriter(
                           socket.getOutputStream())));

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



         

0
 
LVL 92

Expert Comment

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

Accepted Solution

by:
objects earned 30 total points
ID: 6394905
0
 

Author Comment

by:TLTEO
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
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

635 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