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

com.paypal.http.HttpRequest Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package com.paypal.http;

public class HttpRequest {

	public HttpRequest(String path, String verb, Class responseClass) {
		this.path = path;
		this.verb = verb;
		this.responseClass = responseClass;
	}

	private String path;
	private String verb;
	private Object body;
	private Class responseClass;
	private Headers headers = new Headers();

	public HttpRequest path(String path) {
		this.path = path;
		return this;
	}

	public HttpRequest verb(String verb) {
		this.verb = verb;
		return this;
	}

	public HttpRequest requestBody(Object body) {
		this.body = body;
		return this;
	}

	public String path() {
		return this.path;
	}

	public String verb() {
		return this.verb;
	}

	public Object requestBody() {
		return this.body;
	}

	public Headers headers() {
		return this.headers;
	}

	public Class responseClass() {
		return this.responseClass;
	}

	public HttpRequest header(String header, String value) {
		headers.header(header, value);
		return this;
	}

	public HttpRequest copy() {
		HttpRequest other = new HttpRequest(path, verb, responseClass);
		for (String key: headers) {
			other.header(key, headers.header(key));
		}

		other.body = body;

		return other;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy