List of usage examples for org.apache.commons.httpclient.contrib.proxy ProxyDetectionException getMessage
public String getMessage()
From source file:org.apache.commons.httpclient.contrib.proxy.PluginProxyTestApplet.java
private void detectProxy() { String urlString = urlTextField.getText(); if (urlString == null || "".equals(urlString)) { JOptionPane.showMessageDialog(super.getRootPane(), "URL can't be empty", "Missing URL", JOptionPane.ERROR_MESSAGE); return;/*from w w w . jav a 2 s. com*/ } if (!urlString.startsWith("http://")) { urlString = "http://" + urlString; } try { URL url = new URL(urlString); HttpHost hostInfo = PluginProxyUtil.detectProxy(url); if (hostInfo != null) { hostLabel.setText(hostInfo.getHostName()); portLabel.setText("" + hostInfo.getPort()); } else { hostLabel.setText("none"); portLabel.setText("none"); } grid.validate(); } catch (ProxyDetectionException e) { JOptionPane.showMessageDialog(getRootPane(), e.getMessage(), "Proxy Detection Failed", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } catch (Exception e) { JOptionPane.showMessageDialog(getRootPane(), e.getMessage(), "Unexpected Exception", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } }