Package com.veeva.vault.sdk.api.http
Interface HttpWebRequest.Builder<B extends HttpWebRequest.Builder>
- Type Parameters:
B- the extended Builder. For example,FormHttpRequest.Builder.
- All Known Subinterfaces:
FormHttpRequest.Builder
- Enclosing interface:
- HttpWebRequest
public static interface HttpWebRequest.Builder<B extends HttpWebRequest.Builder>
Builds an
HttpWebRequest.-
Method Summary
Modifier and TypeMethodDescriptionwithConnectionName(String connectionName) Specify aconnectionName(local, Vault to Vault, or external connection).withHeader(String name, String value) Specifies an HTTP request header.withLocalConnection(RequestContextUserType requestContextUserType) Specify aRequestContextUserTypeto represent a local connection to the current vault as the provided user type.withMethod(HttpMethod method) Specifies the HTTP method of the request.Appends the given path to the base URL.withQuerystringParam(String name, String value) Specifies a query string param.withResolveTokens(boolean resolveTokens) Specifies whether to resolve tokens used in headers, body parameters, and body.withTimeout(int timeout) Specifies the maximum time in milliseconds to wait for this HTTP request to complete execution.withTokenRequest(TokenRequest tokenRequest) Specifies the custom tokens that should be resolved in headers, body parameters, and body.
-
Method Details
-
withMethod
Specifies the HTTP method of the request. If not specified, requests with asetBodymethod default toPOSTand all other requests default toGET.- Parameters:
method- HTTP method- Returns:
- this
HttpWebRequest.Builder
-
withHeader
Specifies an HTTP request header. Each call with the same name adds to the List of already specified values. Use only the following request headers withwithHeader:Content-Type: See theHttpRequestContentTypefor supported content types.Authorization: Pass the currentsessionIdon Vault API calls. Learn more about Session IDs in the Developer Portal.X-VaultAPI-ClientID: Pass a client ID with this request. Learn more about client IDs in the Developer Portal.
- Parameters:
name- header name. Cannot be null or empty.value- header value. Cannot be null.- Returns:
- this
HttpWebRequest.Builder
-
withPath
Appends the given path to the base URL.- Parameters:
path- path to append. Cannot be null.- Returns:
- this
HttpWebRequest.Builder
-
withQuerystringParam
Specifies a query string param.- Parameters:
name- query string param name. Cannot be null or empty.value- query string param value. Cannot be null.- Returns:
- this
HttpWebRequest.Builder
-
withTimeout
Specifies the maximum time in milliseconds to wait for this HTTP request to complete execution. Must be greater than 0.- Parameters:
timeout- timeout in milliseconds- Returns:
- this
HttpWebRequest.Builder
-
withTokenRequest
Specifies the custom tokens that should be resolved in headers, body parameters, and body.For these tokens to be resolved, token resolution must be enabled with
withResolveTokens(boolean).- Parameters:
tokenRequest- , the token request containing the mapping from token names to their values. Cannot be null.- Returns:
- this
HttpWebRequest.Builder
-
withResolveTokens
Specifies whether to resolve tokens used in headers, body parameters, and body. Tokens used in query string parameters are not resolved.By default, tokens are not resolved. You must call this method to resolve tokens.
- Parameters:
resolveTokens- true if tokens have to be resolved, otherwise false- Returns:
- this
HttpWebRequest.Builder
-
withConnectionName
Specify aconnectionName(local, Vault to Vault, or external connection). EitherconnectionNameorrequestContextUserTypeis required to create a Http request- Parameters:
connectionName- name of a local, Vault to Vault, or external connection. Must be a connection with "active" lifecycle state. Cannot be null or empty.- Returns:
- this
HttpWebRequest.Builder
-
withLocalConnection
Specify aRequestContextUserTypeto represent a local connection to the current vault as the provided user type. EitherrequestContextUserTypeorconnectionNameis required to create a Http request- Parameters:
requestContextUserType-- Returns:
- this
HttpWebRequest.Builder
-