/** * Performs an HTTP-Get request and provides typed access to the response. * * @param <T> * @param worker * @param url * @param headers * may be null * @return some object from the url, null, if url is not valid * @throws IOException */ public static <T> T get( Worker<T> worker, String url, Map<String, String> headers ) throws IOException { return get( worker, url, headers, null, null ); }
/** * @return an input stream from the URL * @throws IOException */ public InputStream openStream() throws IOException { // custom handlers should handle proxies themselves if ( handler != null ) { return url.openStream(); } return get( STREAM, url.toExternalForm(), null ); }
/** * Initializes this <code>XMLAdapter</code> with the content from the given <code>URL</code>. Sets the SystemId, * too. * * @param url * source of the xml content * @throws XMLProcessingException */ public void load( URL url ) throws XMLProcessingException { if ( url == null ) { throw new IllegalArgumentException( "The given url may not be null" ); } try { load( get( STREAM, url.toExternalForm(), null ), url.toExternalForm() ); } catch ( IOException e ) { throw new XMLProcessingException( e.getMessage(), e ); } }
/** * Same as #load(URL), but with http basic authentication * * @param url * @param httpBasicUser * @param httpBasicPass * @throws XMLProcessingException */ public void load( URL url, String httpBasicUser, String httpBasicPass ) throws XMLProcessingException { if ( url == null ) { throw new IllegalArgumentException( "The given url may not be null" ); } try { load( get( STREAM, url.toExternalForm(), null, httpBasicUser, httpBasicPass ), url.toExternalForm() ); } catch ( IOException e ) { throw new XMLProcessingException( e.getMessage(), e ); } }
} else { LOG.debug( "GET" ); is = HttpUtils.get( HttpUtils.STREAM, href.toString(), headers );