/** * Returns context with AuthCache or null in case of any exception was thrown. * Use "http" schema. * * @param host * @param port * @param user * @param password * @return {@link org.apache.http.client.protocol.HttpClientContext HttpClientContext} */ public static HttpClientContext createPreemptiveBasicAuthentication( String host, int port, String user, String password ) { return createPreemptiveBasicAuthentication( host, port, user, password, "http" ); }
/** * @param response the httpresponse for processing * @param charset the charset used for getting HttpEntity * @return HttpEntity in decoded String representation using provided charset * @throws IOException */ public static String responseToString( HttpResponse response, Charset charset ) throws IOException { return responseToString( response, charset, false ); }
/** * @param response the httpresponse for processing * @return HttpEntity in String representation using "UTF-8" encoding * @throws IOException */ public static String responseToString( HttpResponse response ) throws IOException { return responseToString( response, Charset.forName( StandardCharsets.UTF_8.name() ) ); }