Révision 2893
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenLocalizedWebPage.java (revision 2893) | ||
---|---|---|
94 | 94 |
URL url = new URL(urltoTest); |
95 | 95 |
if (url.getProtocol().equals("https")) { |
96 | 96 |
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); |
97 |
if (connection.getResponseCode() != HttpsURLConnection.HTTP_OK) { |
|
98 |
Log.fine(NLS.bind("HTTP Error while testing the \"{0}\" web page: {1}", urltoTest, connection.getResponseCode())); |
|
99 |
connection.disconnect(); |
|
100 |
return alternativeUrl; |
|
101 |
} |
|
97 | 102 |
connection.disconnect(); |
98 | 103 |
} else { |
99 | 104 |
url.openStream().close(); |
... | ... | |
190 | 195 |
return OpenBrowser.openfile(key); //$NON-NLS-1$ |
191 | 196 |
} |
192 | 197 |
} |
198 |
|
|
199 |
public static void main(String args[]) { |
|
200 |
String s = getValidURL("https://stackoverflow.com/questionz", "https://stackoverflow.com/questions"); |
|
201 |
System.out.println(s); |
|
202 |
} |
|
193 | 203 |
} |
Formats disponibles : Unified diff