Class Request.Builder
- java.lang.Object
-
- com.mongodb.stitch.core.internal.net.Request.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
Constructs a new builder.
-
Method Summary
Modifier and Type Method Description Request
build()
Builds, validates, and returns theRequest
.byte[]
getBody()
Returns a copy of the body that will be sent along with the request.Map<String,String>
getHeaders()
Returns the headers that will be included in the request.Method
getMethod()
Returns the HTTP method of the request.Long
getTimeout()
Returns the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.String
getUrl()
Returns the URL that the request will be performed against.Request.Builder
withBody(byte[] body)
Sets a copy of the body that will be sent along with the request.Request.Builder
withHeaders(Map<String,String> headers)
Sets the headers that will be included in the request.Request.Builder
withMethod(Method method)
Sets the HTTP method of the request.Request.Builder
withTimeout(Long timeout)
Sets the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.Request.Builder
withUrl(String url)
Sets the URL that the request will be performed against.
-
-
-
Method Detail
-
withUrl
public Request.Builder withUrl(String url)
Sets the URL that the request will be performed against.- Parameters:
url
- the URL that the request will be performed against.- Returns:
- the builder.
-
withTimeout
public Request.Builder withTimeout(Long timeout)
Sets the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.- Parameters:
timeout
- the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.- Returns:
- the builder.
-
withHeaders
public Request.Builder withHeaders(Map<String,String> headers)
Sets the headers that will be included in the request.- Parameters:
headers
- the headers that will be included in the request.- Returns:
- the builder.
-
withBody
public Request.Builder withBody(byte[] body)
Sets a copy of the body that will be sent along with the request.- Parameters:
body
- the body that will be sent along with the request.- Returns:
- the builder.
-
withMethod
public Request.Builder withMethod(Method method)
Sets the HTTP method of the request.- Parameters:
method
- the HTTP method of the request.- Returns:
- the builder.
-
getUrl
public String getUrl()
Returns the URL that the request will be performed against.- Returns:
- the URL that the request will be performed against.
-
getTimeout
public Long getTimeout()
Returns the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.- Returns:
- the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.
-
getHeaders
public Map<String,String> getHeaders()
Returns the headers that will be included in the request.- Returns:
- the headers that will be included in the request.
-
getBody
public byte[] getBody()
Returns a copy of the body that will be sent along with the request.- Returns:
- a copy of the body that will be sent along with the request.
-
getMethod
public Method getMethod()
Returns the HTTP method of the request.- Returns:
- the HTTP method of the request.
-
-