hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: How to over come the deprication API problem?
Date Sat, 25 Feb 2006 14:02:06 GMT
Hello Sanjeev,

put a little less code into a single statement or use a typecast:

option 1:

ProtocolSocketFactory psf = new AuthSSLProtocolSocketFactory
   (new URL("file:" + strClientKeyStore), strClientKeyStorePassword,
    new URL("file:" + strServerTrustStore), strServerTrustStorePassword);
authhttps = new Protocol("https", psf, 443);


option 2:

    authhttps = new Protocol("https",
      (ProtocolSocketFactory) new AuthSSLProtocolSocketFactory(new URL("file:"
        + strClientKeyStore), strClientKeyStorePassword,
        new URL("file:" + strServerTrustStore),
        strServerTrustStorePassword), 443);


cheers,
  Roland

Sanjeev Kumar Neemkar wrote:
>  Hi,
> How to over come the deprication API problem?
> *Protocol*<file:///C:/Sanjeev/commons-httpclient-3.0-rc4/docs/apidocs/org/apache/commons/httpclient/protocol/Protocol.html#Protocol(java.lang.String,
> org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory, int)>(
> String <http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html> scheme,
> SecureProtocolSocketFactory<file:///C:/Sanjeev/commons-httpclient-3.0-rc4/docs/apidocs/org/apache/commons/httpclient/protocol/SecureProtocolSocketFactory.html>
> factory,
> int defaultPort) is depricated.
> AuthSSLProtocolSocketFactory is sub-class of
> SecureProtocolSocketFactory<file:///C:/Sanjeev/commons-httpclient-3.0-rc4/docs/apidocs/org/apache/commons/httpclient/protocol/SecureProtocolSocketFactory.html>.
> 
> 
> *used **AuthSSLProtocolSocketFactory located
> at*http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/httpclient/trunk/src/contrib/org/apache/commons/httpclient/contrib/ssl/AuthSSLProtocolSocketFactory.java?view=markup<http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/httpclient/trunk/src/contrib/org/apache/commons/httpclient/contrib/ssl/AuthSSLProtocolSocketFactory.java?view=markup>
> 
> Simirarly HttpRecoverableException is also depricated. What is the
> alternative for it when used eith AuthSSLProtocolSocketFactory ?
> 
>  -Sanjeev
> 
> Code snnipet below...
> // java code used
> public ABCCLiGet() {
>   try {
>    authhttps = new Protocol("https",
>      new AuthSSLProtocolSocketFactory(new URL("file:"
>        + strClientKeyStore), strClientKeyStorePassword,
>        new URL("file:" + strServerTrustStore),
>        strServerTrustStorePassword), 443);
>    Protocol.registerProtocol("https", authhttps);
>   } catch (Exception ex) {
>    ourLogger.error("Error while registering Protocol", ex);
>    ex.printStackTrace();
>   }
>  }
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message