List of usage examples for org.apache.http.impl.client SystemDefaultHttpClient execute
public CloseableHttpResponse execute(final HttpUriRequest request, final HttpContext context) throws IOException, ClientProtocolException
From source file:de.badw.strauss.glyphpicker.controller.alltab.TeiLoadWorker.java
/** * Loads TEI data from a URL.// w ww . ja v a2 s. co m * * @return the resulting GlyphDefinition list */ public List<GlyphDefinition> loadDataFromUrl() { SystemDefaultHttpClient httpClient = new SystemDefaultHttpClient(); try { HttpGet httpGet = new HttpGet(dataSource.getBasePath()); return httpClient.execute(httpGet, new XMLResponseHandler()); } catch (IOException e) { String message = String.format(i18n.getString("TeiLoadWorker.couldNotLoadData"), e.getLocalizedMessage(), dataSource.getBasePath()); if (e instanceof UnknownHostException) { message += " Unknown host"; } JOptionPane.showMessageDialog(null, message, i18n.getString("TeiLoadWorker.error"), JOptionPane.ERROR_MESSAGE); LOGGER.info(e); } finally { httpClient.getConnectionManager().shutdown(); } return null; }