Code example for BasicCredentialsProvider

0
        params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(1));
        params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setContentCharset(params, "utf8");
  
        CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
         
//	        credentialsProvider.setCredentials(new AuthScope("cooper.apphb.com", AuthScope.ANY_PORT) 
//	        	, new UsernamePasswordCredentials("UserNameHere", "UserPasswordHere")); 
        clientConnectionManager = new ThreadSafeClientConnManager(params, schemeRegistry);
  
        context = new BasicHttpContext();
        context.setAttribute("http.auth.credentials-provider", credentialsProvider);
	} 
	 
	public DefaultHttpClient getHttpClient()
	{ 
		 
		DefaultHttpClient httpClient = new DefaultHttpClient(clientConnectionManager, params);
		 
Contextual code suggestions in your IDE  Get Codota for Java