You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by "Pill, Juergen" <Ju...@softwareag.com> on 2001/10/01 10:17:06 UTC

RE: SSL support in webdav client library

In following method some ssl code in un-commented, might this be part of
your problem?

	protected void openConnection() throws IOException,
UnknownHostException {

		try {
			if (socket == null) {
				if (proxyHost == null || proxyPort < 0) {
					if (debug > 0)
						System.out.println
							("Reopen connection
: Host:"
							 + sessionHost + "
Port:" + sessionPort);
					if(https) {
						socket = new Socket
							(this.sessionHost,
this.sessionPort);
						//socket =
SSLSocketFactory.getDefault().createSocket
						//(this.sessionHost,
this.sessionPort);
					} else {
						socket = new Socket
							(this.sessionHost,
this.sessionPort);
					}
				} else {
					if (debug > 0)
						System.out.println("Reopen
connection : Host:"
	
+ proxyHost + " Port:" + proxyPort);
					socket = new Socket(this.proxyHost,
this.proxyPort);
				}
			}
			input = socket.getInputStream();
			output = socket.getOutputStream();
		} catch (IOException e) {
			if (connectionInterceptor != null) {
				connectionInterceptor.error(-1, e);
			}

			// Connection is probably half closed
			// Closing the connection and trying again
			if (socket != null) {
				socket.close();
				socket = null;
			}

			throw e;
		}

		if (connectionInterceptor != null) {
			connectionInterceptor.connect();
		}

	}



Juergen




 -----Original Message-----
From: 	Raj Kumar [mailto:kothapa@intalio.com] 
Sent:	Friday, September 28, 2001 23.35 PM
To:	slide-dev@jakarta.apache.org
Subject:	RE: SSL support in webdav client library

hi,
  The only thing that i can think now is that you might get some more
information by running the command line example in debug mode.Looking at the
source it looks like the exception is thrown when the client has tried 5
times to make a connection to the server and was unsuccessfull.You need to
find out what is the actual exception that is causing the client's retries
to fail(by running in debug mode). Is there any information available on the
server console or any of the logs file.Can you find out the status code that
is returned.
   rajkumar     

-----Original Message-----
From: Jiantao Pan [mailto:jiantao.pan@labbook.com]
Sent: Friday, September 28, 2001 1:50 PM
To: slide-dev@jakarta.apache.org
Subject: RE: SSL support in webdav client library


I run the following test code for HttpClient, It does not work. the
exception is:

org.apache.commons.httpclient.HttpException: Unable to process request 	
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6
57) 	
at com.labbook.test.HttpClientTest.main(HttpClientTest.java:37)

Any suggestions? The code follows:

import java.io.*;
import java.net.*;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
public class HttpClientTest {

	public static void main (String[] args) throws Exception {
		System.setProperty("java.protocol.handler.pkgs",
			"com.sun.net.ssl.internal.www.protocol");

            HttpClient httpClient = new HttpClient();
            httpClient.startSession("localhost", 8443, true);
            GetMethod gm = new
GetMethod("/slide/files/SystemGoals.htm",true,"c:\\tmp");
            httpClient.executeMethod(gm);
            InputStream is = gm.getData();
		BufferedReader in = new BufferedReader(
			new InputStreamReader(is));

		String line;
		while ((line = in.readLine()) != null) {
			System.out.println(line);
		}
		in.close();
	}
}

-----Original Message-----
From: Jiantao Pan 
Sent: Friday, September 28, 2001 4:34 PM
To: slide-dev@jakarta.apache.org
Subject: RE: SSL support in webdav client library


Thanks Raj.
 However, when I followed the steps and verified that the jsse is setup
right.
Then run the org.apache.webdav.cmd.Slide with 
-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol
 option
 when typing "open https://localhost:8443"
 It give me:Error: Unable to process request. 
 I guess the HttpClient class support ssl, However other webdav client
class does not. Please let me know if you have any suggestions on this.

 
-----Original Message-----
From: Raj Kumar [mailto:kothapa@intalio.com]
Sent: Friday, September 28, 2001 4:02 PM
To: slide-dev@jakarta.apache.org
Subject: RE: SSL support in webdav client library


hi,
   There is support for the ssl in the webdav client library.
   Some configuration needs to be done for the VM on the cient side
running the Webdav Client classes.
   I am attaching the documentation that comes with the HttpClient class
.

      /**
       * HTTP client main class.
       * <p>
       * HTTPS URLs are now supported.  To use HTTPS, you'll
       * need an implementation of the
       * <a href="http://java.sun.com/products/jsse/">Java Secure
Sockets Extension</a>
       * installed and configured.  Make sure that you've enabled
       * the appropriate provider with your JRE (e.g., set
       * <br>
       *
<tt>security.provider.<i>&lt;n&gt;</i>=com.sun.net.ssl.internal.ssl.Prov
ider</tt>
       * <br>
       * in your JRE's <tt>java.security</tt> file) and with the
       * VM that is running the HttpClient (e.g., set the
       * system property <tt>java.protocol.handler.pkgs</tt>
       * to include your provider, such as
       * <tt>com.sun.net.ssl.internal.www.protocol</tt>
       * for the reference implementation of JSSE).

          rajkumar
 

-----Original Message-----
From: Jiantao Pan [mailto:jiantao.pan@labbook.com]
Sent: Friday, September 28, 2001 12:54 PM
To: slide-dev@jakarta.apache.org
Subject: SSL support in webdav client library


Hi,
  It seems to me that the webdav client library currently does not
support SSL. Correct me if I am wrong. 
  Could anyone give some suggestions or pointers on how to add SSL
support to the webdav client?
  Thanks and have a good one.
Jiantao