All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.despegar.http.client.WithBodyMethod Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
package com.despegar.http.client;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;

public abstract class WithBodyMethod extends HttpMethod {

	private String body;
	
	public WithBodyMethod(String url, String name, String body) {
		super(url, name, true);
		this.body = body;
	}
	
	@Override
    protected void writeBody(HttpURLConnection connection) throws IOException {
	    OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
        writer.write(this.body);
        writer.close();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy