aQute.bnd.http.HttpRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biz.aQute.bndlib Show documentation
Show all versions of biz.aQute.bndlib Show documentation
bndlib: A Swiss Army Knife for OSGi
package aQute.bnd.http;
import java.io.File;
import java.lang.reflect.Type;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import org.osgi.util.promise.Deferred;
import org.osgi.util.promise.Promise;
import aQute.bnd.osgi.Processor;
import aQute.bnd.service.url.TaggedData;
import aQute.lib.converter.TypeReference;
import aQute.service.reporter.Reporter;
/**
* Builds up a request
*
* @param
*/
@SuppressWarnings("unchecked")
public class HttpRequest {
String verb = "GET";
Object upload;
Type download;
Map headers = new HashMap<>();
long timeout = -1;
HttpClient client;
String ifNoneMatch;
long ifModifiedSince;
long ifUnmodifiedSince;
URL url;
int redirects = 10;
String ifMatch;
boolean cached;
long maxStale;
Reporter reporter;
File useCacheFile;
boolean updateTag;
HttpRequest(HttpClient client) {
this.client = client;
}
/**
* Convert the result to a specific type
*/
public HttpRequest get(Class type) {
this.download = type;
return (HttpRequest) this;
}
/**
* Convert the result to a specific type
*/
public HttpRequest get(TypeReference type) {
this.download = type.getType();
return (HttpRequest) this;
}
/**
* Convert the result to a specific type
*/
public HttpRequest