Modifier | Constructor and Description |
---|---|
protected |
Builder(Request.Method method,
String url)
Constructs an instance of builder.
|
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
|
VRequest |
build()
Builds the request with the options specified.
|
static VRequest.Builder |
delete(String url)
Creates a new instance of builder with method type delete.
|
static VRequest.Builder |
get(String url)
Creates a new instance of builder with method type get.
|
static VRequest.Builder |
head(String url)
Creates a new instance of builder with method type head.
|
static VRequest.Builder |
options(String url)
Creates a new instance of builder with method type options.
|
static VRequest.Builder |
post(String url)
Creates a new instance of builder with method type post.
|
static VRequest.Builder |
put(String url)
Creates a new instance of builder with method type put.
|
T |
removeHeader(String name)
Remove a header from this request.
|
T |
removeHeaders()
Remove all headers from this request.
|
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 Crawler for this request.
|
T |
setUrl(String url)
Sets the url to be fetched.
|
protected Builder(Request.Method method, String url)
method
- The method for this requesturl
- The url for this requestpublic static VRequest.Builder get(String url)
url
- url to fetch.public static VRequest.Builder post(String url)
url
- url to fetch.public static VRequest.Builder head(String url)
url
- url to fetch.public static VRequest.Builder put(String url)
url
- url to fetch.public static VRequest.Builder delete(String url)
url
- url to fetch.public static VRequest.Builder options(String url)
url
- url to fetch.public final T setBody(String body)
body
- request bodypublic final T setSleepScheduler(SleepScheduler scheduler)
scheduler
- sleep scheduler to be used.public final T setProxy(org.apache.http.HttpHost proxy)
proxy
- proxy to be used.public final T removeHeader(String name)
name
- The key of the header to removepublic final T removeHeaders()
public final T addHeaders(Map<String,String> headers)
This will merge with headers set in Crawler class. If a same key is found, this will override that header in Crawler class.
headers
- request headerspublic final T addHeader(String name, String value)
This will merge with headers set in Crawler class. If a same key is found, this will override that header in Crawler class.
name
- name/key of the headervalue
- value of the headerpublic final T setUrl(String url)
url
- url to fetch.public VRequest build()
Copyright © 2018. All rights reserved.