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

net.sf.aguacate.http.HttpMethods Maven / Gradle / Ivy

There is a newer version: 0.10.9
Show newest version
package net.sf.aguacate.http;

public final class HttpMethods {

	public static final String M_DELETE = "DELETE";

	public static final String M_PUT = "PUT";

	public static final String M_POST = "POST";

	public static final String M_GET = "GET";

	public static final String M_GET0 = "GET0";

	public static final String M_PATCH = "PATCH";

	private HttpMethods() {
	}

	public static boolean acceptsBodyRequest(String method) {
		switch (method) {
		case M_GET:
			return false;
		case M_POST:
		case M_PUT:
		case M_DELETE:
		case M_PATCH:
			return true;
		default:
			throw new IllegalArgumentException(method);
		}
	}

	public static boolean acceptsBodyResponse(String method) {
		switch (method) {
		case M_GET0:
		case M_GET:
		case M_POST:
		case M_PUT:
		case M_PATCH:
			return true;
		case M_DELETE:
			return false;
		default:
			throw new IllegalArgumentException(method);
		}
	}
	
	public static boolean acceptsPathParameters(String method) {
		switch (method) {
		case M_PUT:
			return false;
		case M_GET:
		case M_POST:
		case M_DELETE:
		case M_PATCH:
			return true;
		default:
			throw new IllegalArgumentException(method);
		}
	}
	
	public static boolean optionalPathParameters(String method) {
		switch (method) {
		case M_GET:
			return true;
		case M_POST:
		case M_DELETE:
		case M_PATCH:
			return false;
		case M_PUT:
		default:
			throw new IllegalArgumentException(method);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy