Code example for AuthScope

0
    	return sendPost(uri, path, params, "application/json");
    } 
     
    public String sendPost(URI uri, String path, Map<String, String> params, String contentType) {
		Credentials creds = new UsernamePasswordCredentials(params.get("username"), params.get("password"));
		AuthScope authscope = new AuthScope(uri.getHost(), uri.getPort());
		httpClient.getCredentialsProvider().setCredentials(authscope, creds);
		JSONObject data = new JSONObject(params);
    	 
        String ret = null;
 
        httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
 
        httpPost = new HttpPost(uri);
        response = null;
 
        StringEntity tmp = null;        
 
        Log.d("Your App Name Here", "Setting httpPost headers");
 
        httpPost.setHeader("User-Agent", "SET YOUR USER AGENT STRING HERE");