- All Superinterfaces:
- Connection, ContentConnection, HttpConnection, InputConnection, OutputConnection, StreamConnection
- See Also:
-
CertificateException
public int getPort()
- See Also:
- HttpConnection
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1914]
By iqueen on 2007/08/06 22:25:44 Rate
private static final int RETRY = 3;
private static Connection openConnection ( String URL ) {
Connection cnn = null;
for ( int i = 0; i < RETRY; i++ ) {
try {
cnn = Connector.open ( URL ) ;
break;
} catch ( ConnectionNotFoundException e ) {
// ignored, keep retrying
} catch ( IOException e ) {
// TODO Auto-generated catch block
e.printStackTrace ( ) ;
} catch ( SecurityException e ) {
break;
}
}
return cnn;
}
public static HttpConnection openHttpsConnection ( String URL ) {
return openHttpsConnection ( URL, null ) ;
}
private static HttpConnection openHttpsConnection ( String URL, String method ) {
Connection connection = openConnection ( URL ) ;
HttpsConnection httpsConnection = null;
httpsConnection = ( HttpsConnection ) connection;
if ( method != null ) {
try {
httpsConnection.setRequestMethod ( method ) ;
} catch ( IOException e ) {
// TODO Auto-generated catch block
e.printStackTrace ( ) ;
}
}
return httpsConnection;
}
public SecurityInfo getSecurityInfo()
throws java.io.IOException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples