public static InputStream prepareInputStream ( final URL url , final boolean acceptAnyCertificate ) throws IOException { final URLConnection conn = url . openConnection ( ) ; prepareForAuthentication ( conn ) ; prepareHttpHeaders ( conn ) ; if ( acceptAnyCertificate ) { prepareForSSL ( conn ) ; } return conn . getInputStream ( ) ; }
Prepare url for authentication and ssl if necessary and returns the input stream from the url .