public static class BasicRequest.Builder<T extends BasicRequest.Builder<T>> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Builder(Request.Method method,
String url) |
| Modifier and Type | Method and Description |
|---|---|
T |
addHeader(String name,
String value)
Adds header to be used
|
T |
addHeaders(Map<String,String> headers)
Add headers to be used
|
BasicRequest |
build()
Builds the request with the options specified.
|
static BasicRequest.Builder |
delete(String url)
Creates a new instance of builder with method type delete.
|
static BasicRequest.Builder |
get(String url)
Creates a new instance of builder with method type get.
|
static BasicRequest.Builder |
head(String url)
Creates a new instance of builder with method type head.
|
static BasicRequest.Builder |
options(String url)
Creates a new instance of builder with method type options.
|
static BasicRequest.Builder |
post(String url)
Creates a new instance of builder with method type post.
|
static BasicRequest.Builder |
put(String url)
Creates a new instance of builder with method type put.
|
T |
removeHeader(String name) |
T |
removeHeaders() |
T |
setBody(String body)
Sets the request body to be used.
|
T |
setProxy(org.apache.http.HttpHost proxy)
Sets the proxy to be used, this will override the
proxy selected in Fetcher for this request.
|
T |
setSleepScheduler(SleepScheduler scheduler)
Sets the sleep scheduler to be used, this will override the
sleep scheduler defined in AsyncCrawler for this request.
|
T |
setUrl(String url)
Sets the url to be fetched.
|
protected Builder(Request.Method method, String url)
public static BasicRequest.Builder get(String url)
url - url to fetch.public static BasicRequest.Builder post(String url)
url - url to fetch.public static BasicRequest.Builder head(String url)
url - url to fetch.public static BasicRequest.Builder put(String url)
url - url to fetch.public static BasicRequest.Builder delete(String url)
url - url to fetch.public static BasicRequest.Builder options(String url)
url - url to fetch.public T setBody(String body)
body - request bodypublic T setSleepScheduler(SleepScheduler scheduler)
scheduler - sleep scheduler to be used.public T setProxy(org.apache.http.HttpHost proxy)
proxy - proxy to be used.public T removeHeaders()
public T addHeaders(Map<String,String> headers)
This will merge with headers set in AsyncCrawler class. If a same key is found, this will override that header in AsyncCrawler class.
headers - request headerspublic T addHeader(String name, String value)
This will merge with headers set in AsyncCrawler class. If a same key is found, this will override that header in AsyncCrawler class.
name - name/key of the headervalue - value of the headerpublic T setUrl(String url)
url - url to fetch.public BasicRequest build()
Copyright © 2018. All rights reserved.