Package com.symphony.bdk.http.jersey2
Class ApiClientJersey2
java.lang.Object
com.symphony.bdk.http.jersey2.ApiClientJersey2
- All Implemented Interfaces:
com.symphony.bdk.http.api.ApiClient
@API(status=STABLE)
public class ApiClientJersey2
extends Object
implements com.symphony.bdk.http.api.ApiClient
Jersey2 implementation for the
ApiClient interface called by generated code.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildResponseHeaders(jakarta.ws.rs.core.Response response) protected <T> Tdeserialize(jakarta.ws.rs.core.Response response, jakarta.ws.rs.core.GenericType<T> returnType) Deserialize response body to Java object according to the Content-Type.protected FiledownloadFileFromResponse(jakarta.ws.rs.core.Response response) Download file from the given response.escapeString(String str) <T> com.symphony.bdk.http.api.ApiResponse<T>invokeAPI(String path, String method, List<com.symphony.bdk.http.api.Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, com.symphony.bdk.http.api.util.TypeReference<T> returnType) protected booleanisJsonMime(String mime) Check if the given MIME is a JSON MIME.List<com.symphony.bdk.http.api.Pair>parameterToPairs(String collectionFormat, String name, Object value) parameterToString(Object param) protected FileprepareDownloadFile(jakarta.ws.rs.core.Response response) selectHeaderAccept(String[] accepts) selectHeaderContentType(String[] contentTypes) protected jakarta.ws.rs.client.Entity<?>Serialize the given Java object into string entity according the given Content-Type (only JSON is supported for now).protected voidupdateParamsForAuth(String[] authNames, Map<String, String> headerParams) Update query and header parameters based on authentication settings.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.symphony.bdk.http.api.ApiClient
rotate
-
Field Details
-
httpClient
protected jakarta.ws.rs.client.Client httpClient -
basePath
-
defaultHeaderMap
-
tempFolderPath
-
authentications
-
enforcedAuthenticationSchemes
-
-
Constructor Details
-
ApiClientJersey2
-
-
Method Details
-
invokeAPI
public <T> com.symphony.bdk.http.api.ApiResponse<T> invokeAPI(String path, String method, List<com.symphony.bdk.http.api.Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, throws com.symphony.bdk.http.api.ApiExceptionString> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, com.symphony.bdk.http.api.util.TypeReference<T> returnType) - Specified by:
invokeAPIin interfacecom.symphony.bdk.http.api.ApiClient- Throws:
com.symphony.bdk.http.api.ApiException
-
getBasePath
- Specified by:
getBasePathin interfacecom.symphony.bdk.http.api.ApiClient
-
parameterToString
- Specified by:
parameterToStringin interfacecom.symphony.bdk.http.api.ApiClient
-
parameterToPairs
public List<com.symphony.bdk.http.api.Pair> parameterToPairs(String collectionFormat, String name, Object value) - Specified by:
parameterToPairsin interfacecom.symphony.bdk.http.api.ApiClient
-
selectHeaderAccept
- Specified by:
selectHeaderAcceptin interfacecom.symphony.bdk.http.api.ApiClient
-
selectHeaderContentType
- Specified by:
selectHeaderContentTypein interfacecom.symphony.bdk.http.api.ApiClient
-
escapeString
- Specified by:
escapeStringin interfacecom.symphony.bdk.http.api.ApiClient
-
getAuthentications
- Specified by:
getAuthenticationsin interfacecom.symphony.bdk.http.api.ApiClient
-
addEnforcedAuthenticationScheme
- Specified by:
addEnforcedAuthenticationSchemein interfacecom.symphony.bdk.http.api.ApiClient
-
isJsonMime
Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also default to JSON- Parameters:
mime- MIME- Returns:
- True if the MIME type is JSON
-
serialize
protected jakarta.ws.rs.client.Entity<?> serialize(Object obj, Map<String, Object> formParams, String contentType) Serialize the given Java object into string entity according the given Content-Type (only JSON is supported for now).- Parameters:
obj- ObjectformParams- Form parameterscontentType- Context type- Returns:
- Entity
-
deserialize
protected <T> T deserialize(jakarta.ws.rs.core.Response response, jakarta.ws.rs.core.GenericType<T> returnType) throws com.symphony.bdk.http.api.ApiException Deserialize response body to Java object according to the Content-Type.- Type Parameters:
T- Type- Parameters:
response- ResponsereturnType- Return type- Returns:
- Deserialize object
- Throws:
com.symphony.bdk.http.api.ApiException- API exception
-
downloadFileFromResponse
protected File downloadFileFromResponse(jakarta.ws.rs.core.Response response) throws com.symphony.bdk.http.api.ApiException Download file from the given response.- Parameters:
response- Response- Returns:
- File
- Throws:
com.symphony.bdk.http.api.ApiException- If fail to read file content from response and write to disk
-
prepareDownloadFile
- Throws:
IOException
-
buildResponseHeaders
-
updateParamsForAuth
protected void updateParamsForAuth(String[] authNames, Map<String, String> headerParams) throws com.symphony.bdk.http.api.ApiExceptionUpdate query and header parameters based on authentication settings.- Parameters:
authNames- The authentications to apply- Throws:
com.symphony.bdk.http.api.ApiException
-