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

gridscale.http.methods.HttpReport Maven / Gradle / Ivy

There is a newer version: 2.53
Show newest version
package gridscale.http.methods;

import org.apache.http.HttpHeaders;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;

import java.net.URI;

public class HttpReport extends HttpEntityEnclosingRequestBase
{
	public static final String METHOD_NAME = "REPORT";

	public HttpReport(final String uri)
	{
		this(URI.create(uri));
	}

	/**
	 * Sets the Depth request header to 0, meaning the
	 * report applies to the resource only.
	 *
	 * @param uri The resource
	 */
	public HttpReport(final URI uri)
	{
		this.setURI(uri);
		this.setDepth("0");
		this.setHeader(HttpHeaders.CONTENT_TYPE, "text/xml; charset=utf-8");
	}

	@Override
	public String getMethod()
	{
		return METHOD_NAME;
	}

	/**
	 * A client may submit a Depth header with a value of "0", "1", or "infinity" with
	 * a {@link com.github.sardine.model.Propfind} on a collection resource with internal member URIs.
	 *
	 * @param depth "0", "1" or "infinity".
	 */
	public HttpReport setDepth(String depth)
	{
		this.setHeader(HttpHeaders.DEPTH, depth);
		return this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy