Solved

using URLHttpsConnection

Posted on 2001-08-14
8
424 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
  • 4
  • 3
8 Comments
 

Expert Comment

by:phlc
Comment Utility
0
 
LVL 92

Expert Comment

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

Author Comment

by:TLTEO
Comment Utility
they don't have the examples really, on URLHttpsConnection.
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

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

Author Comment

by:TLTEO
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now