Package com.microstrategy.webapi.restApi
Class RestClientBuilder
- java.lang.Object
-
- com.microstrategy.webapi.restApi.RestClientBuilder
-
- Direct Known Subclasses:
IServerRestClientBuilder
public class RestClientBuilder extends java.lang.Object
Builder pattern for creating a RestClient
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Object
body
protected java.lang.Integer
connectTimeout
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>
headers
protected boolean
isTLSEnabled
protected java.lang.String
mediaType
protected MethodTypes
methodTypes
protected java.lang.Integer
readTimeout
protected SimpleResponseWrapper
responseWrapper
protected java.lang.String
url
-
Constructor Summary
Constructors Constructor Description RestClientBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RestClientBuilder
addheader(java.lang.String key, java.lang.String value)
adds individual header key-valueRestClientBuilder
body(java.lang.String body)
String as request body.RestClient
build()
RestClientBuilder
connectTimeout(int connectTimeout)
Set http connect timeoutRestClientBuilder
headers(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
RestClientBuilder
mediaType(MediaTypes mediaType)
Set media type using EnumRestClientBuilder
mediaType(java.lang.String mediaType)
Set media type using String valueRestClientBuilder
methodTypes(MethodTypes methodTypes)
RestClientBuilder
readTimeout(int readTimeout)
Set http read timeoutRestClientBuilder
responseWrapper(SimpleResponseWrapper responseWrapper)
Caller can provide its own implementation of SimpleResponseWrapperRestClientBuilder
streamBody(java.io.InputStream inputStream)
Input stream as request body.java.lang.String
toString()
RestClientBuilder
url(java.lang.String url)
-
-
-
Field Detail
-
url
protected java.lang.String url
-
body
protected java.lang.Object body
-
methodTypes
protected MethodTypes methodTypes
-
headers
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers
-
mediaType
protected java.lang.String mediaType
-
responseWrapper
protected SimpleResponseWrapper responseWrapper
-
isTLSEnabled
protected boolean isTLSEnabled
-
connectTimeout
protected java.lang.Integer connectTimeout
-
readTimeout
protected java.lang.Integer readTimeout
-
-
Method Detail
-
url
public RestClientBuilder url(java.lang.String url)
- Parameters:
url
-- Returns:
-
body
public RestClientBuilder body(java.lang.String body)
String as request body.- Parameters:
body
- string- Returns:
- builder
-
streamBody
public RestClientBuilder streamBody(java.io.InputStream inputStream)
Input stream as request body.- Parameters:
inputStream
- input stream- Returns:
- builder
-
methodTypes
public RestClientBuilder methodTypes(MethodTypes methodTypes)
- Parameters:
methodTypes
-- Returns:
-
headers
public RestClientBuilder headers(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
- Parameters:
headers
-- Returns:
-
addheader
public RestClientBuilder addheader(java.lang.String key, java.lang.String value)
adds individual header key-value- Parameters:
key
-value
-- Returns:
-
mediaType
public RestClientBuilder mediaType(java.lang.String mediaType)
Set media type using String value- Parameters:
mediaType
- Any valid "accept" header value- Returns:
-
mediaType
public RestClientBuilder mediaType(MediaTypes mediaType)
Set media type using Enum- Parameters:
mediaType
-- Returns:
-
connectTimeout
public RestClientBuilder connectTimeout(int connectTimeout)
Set http connect timeout- Parameters:
connectTimeout
-- Returns:
-
readTimeout
public RestClientBuilder readTimeout(int readTimeout)
Set http read timeout- Parameters:
readTimeout
-- Returns:
-
responseWrapper
public RestClientBuilder responseWrapper(SimpleResponseWrapper responseWrapper)
Caller can provide its own implementation of SimpleResponseWrapper- Parameters:
responseWrapper
-- Returns:
-
build
public RestClient build() throws MSTRWebAPIException
- Returns:
- Throws:
MSTRWebAPIException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-