protected final class UrlHttpClient.CurlBuilder extends Object
Constructor and Description |
---|
CurlBuilder(URL url)
Builds a new curl command for the given
URL . |
Modifier and Type | Method and Description |
---|---|
String |
build()
Creates a curl command that can be replayed from command line.
|
boolean |
isValid() |
UrlHttpClient.CurlBuilder |
setContent(String content)
Set the content used for the given curl command.
|
UrlHttpClient.CurlBuilder |
setContentOverflow(boolean contentOverflow)
Sets whether or not the content is too large for the curl command.
|
UrlHttpClient.CurlBuilder |
setHeaders(Map<String,String> headers)
Set the headers used for the given curl command.
|
UrlHttpClient.CurlBuilder |
setMethod(String method)
Set the method to call for the given curl command.
|
public UrlHttpClient.CurlBuilder setMethod(String method)
method
- The method to use for the request.public UrlHttpClient.CurlBuilder setHeaders(Map<String,String> headers)
headers
- The headers to use for the request.public UrlHttpClient.CurlBuilder setContent(String content)
content
- The content to use for the request.public UrlHttpClient.CurlBuilder setContentOverflow(boolean contentOverflow)
Integer.MAX_VALUE
are
considered too long. If set, the curl should not be logged as it will
be invalid.contentOverflow
- Whether or not the content is too long to
print.public boolean isValid()
public String build()
IllegalStateException
- If isValid()
returns false.Copyright © 2018. All rights reserved.