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

com.braintreepayments.http.Headers Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
package com.braintreepayments.http;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Headers implements Iterable {

	public static final String CONTENT_TYPE = "Content-Type";
	public static final String AUTHORIZATION = "Authorization";
	public static final String USER_AGENT = "User-Agent";
	public static final String ACCEPT_ENCODING = "Accept-Encoding";

	@Override
	public Iterator iterator() {
		return mHeaders.keySet().iterator();
	}

	protected Map mHeaders = new HashMap();

	public Headers header(String header, String value) {
		mHeaders.put(header, value);
		return this;
	}

	public Headers headerIfNotPresent(String key, String value) {
		if (header(key) == null) {
			return header(key, value);
		}
		return this;
	}

	public Headers remove(String key) {
		mHeaders.remove(key);
		return this;
	}

	public String header(String key) {
		return mHeaders.get(key);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy