Code example for BasicCredentialsProvider

Methods: setCredentials

     * @param password 
    public EasyHttpClient(String username, String password) {
        if(username != null && password != null) {
            UsernamePasswordCredentials c = new UsernamePasswordCredentials(username,password);
            BasicCredentialsProvider cP = new BasicCredentialsProvider();
            cP.setCredentials(AuthScope.ANY, c);
     * Function that creates a ClientConnectionManager which can handle http and https. 
     * In case of https self signed or invalid certificates will be accepted. 
    protected ClientConnectionManager createClientConnectionManager() {
        HttpParams params = new BasicHttpParams();
        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setContentCharset(params, "utf-8");
Contextual code suggestions in your IDE  Get Codota for Java