Code example for HttpPost

Methods: abort

0
 
    public void abort() { 
        try { 
            if (httpClient != null) {
                System.out.println("Abort.");
                httpPost.abort();
            } 
        } catch (Exception e) {
            System.out.println("Your App Name Here" + e);
        } 
    } 
 
    public String sendJSONPost(URI uri, String path, Map<String, String> params) {
    	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);