public class Curl4jEngineRequest extends AbstractEngineRequest
executed, headers, listener, url| Constructor and Description |
|---|
Curl4jEngineRequest(Curl4jHttpEngine engine) |
| Modifier and Type | Method and Description |
|---|---|
Curl4jEngineRequest |
addCustomOption(java.util.function.Consumer<net.covers1624.curl4j.util.CurlHandle> action)
Provide custom configuration to curl.
|
protected void |
assertState() |
Curl4jEngineRequest |
dontFollowRedirects()
Called to tell this request to not follow redirects.
|
Curl4jEngineResponse |
execute()
Execute the given
EngineRequest. |
Curl4jEngineRequest |
header(java.lang.String key,
java.lang.String value)
Add a specific HTTP header to this request.
|
Curl4jEngineRequest |
headers(HeaderList headers)
Add all the specified HTTP headers to this request.
|
Curl4jEngineRequest |
headers(java.util.Map<java.lang.String,java.lang.String> headers)
Add all the specified HTTP headers to this request.
|
Curl4jEngineRequest |
listener(RequestListener listener)
Set a listener to receive progress updates about this transfer.
|
Curl4jEngineRequest |
method(java.lang.String method,
@Nullable WebBody body)
Sets the HTTP method and
WebBody for this request. |
Curl4jEngineRequest |
removeHeader(java.lang.String key)
Removes all the specified HTTP headers with the given key.
|
Curl4jEngineRequest |
unixSocket(java.lang.String unixSocket)
Set the
CURL.CURLOPT_UNIX_SOCKET_PATH option. |
Curl4jEngineRequest |
url(java.lang.String url)
Set the url for this request.
|
Curl4jEngineRequest |
useCABundle(@Nullable net.covers1624.curl4j.CABundle caBundle)
Use the given
CABundle. |
Curl4jEngineRequest |
useFileOutput(java.nio.file.Path destFile)
Tell this Request to store the body in the given file.
|
getHeaders, getUrlclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waiturlpublic Curl4jEngineRequest(Curl4jHttpEngine engine)
public Curl4jEngineRequest method(java.lang.String method, @Nullable @Nullable WebBody body)
EngineRequestWebBody for this request.method - The HTTP method.body - The WebBody.EngineRequest.public Curl4jEngineRequest dontFollowRedirects()
public Curl4jEngineRequest useFileOutput(java.nio.file.Path destFile)
This is a hot-path for downloading files.
If a path is provided, it can be assumed that a WebBody.PathBody
is used on the response.
destFile - The destination file.public Curl4jEngineRequest unixSocket(java.lang.String unixSocket)
CURL.CURLOPT_UNIX_SOCKET_PATH option.unixSocket - The socket.public Curl4jEngineRequest useCABundle(@Nullable @Nullable net.covers1624.curl4j.CABundle caBundle)
CABundle.caBundle - The bundle.public Curl4jEngineRequest addCustomOption(java.util.function.Consumer<net.covers1624.curl4j.util.CurlHandle> action)
These callbacks are called after all default state has been set, but prior to executing the curl operation.
action - The action.public Curl4jEngineRequest url(java.lang.String url)
EngineRequesturl in interface EngineRequesturl in class AbstractEngineRequesturl - The url.EngineRequest.public Curl4jEngineRequest header(java.lang.String key, java.lang.String value)
EngineRequestheader in interface EngineRequestheader in class AbstractEngineRequestkey - The key.value - The value.EngineRequest.public Curl4jEngineRequest headers(java.util.Map<java.lang.String,java.lang.String> headers)
EngineRequestheaders in interface EngineRequestheaders in class AbstractEngineRequestheaders - The headers to add.EngineRequest.public Curl4jEngineRequest headers(HeaderList headers)
EngineRequestheaders in interface EngineRequestheaders in class AbstractEngineRequestheaders - The headers to add.EngineRequest.public Curl4jEngineRequest removeHeader(java.lang.String key)
EngineRequestremoveHeader in interface EngineRequestremoveHeader in class AbstractEngineRequestkey - The key.EngineRequest.public Curl4jEngineRequest listener(RequestListener listener)
EngineRequestNote: This API is still experimental, may crash, may not be supported by all http impls, or may change.
listener in interface EngineRequestlistener in class AbstractEngineRequestlistener - The listener.protected void assertState()
assertState in class AbstractEngineRequestpublic Curl4jEngineResponse execute() throws java.io.IOException
EngineRequestEngineRequest.
This method blocks until the underlying HTTP implementation returns a response, or throws an exception.
EngineResponse for the request.java.io.IOException - Thrown by the underlying HTTP implementation in the event of an error.