Package com.kaltura.client.utils.request
Class BaseRequestBuilder<ReturnedType,SelfType>
- java.lang.Object
-
- com.kaltura.client.utils.request.RequestBuilderData<SelfType>
-
- com.kaltura.client.utils.request.BaseRequestBuilder<ReturnedType,SelfType>
-
- All Implemented Interfaces:
RequestElement<ReturnedType>
- Direct Known Subclasses:
MultiRequestBuilder,RequestBuilder
public abstract class BaseRequestBuilder<ReturnedType,SelfType> extends RequestBuilderData<SelfType> implements RequestElement<ReturnedType>
Created by tehilarozin on 14/08/2016.
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionConfigurationconnectionConfigprotected Filesfilesprotected HashMap<String,String>headersprotected OnCompletion<Response<ReturnedType>>onCompletioncallback for the parsed response.protected Class<ReturnedType>typeprotected Stringurl-
Fields inherited from class com.kaltura.client.utils.request.RequestBuilderData
params
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseRequestBuilder(Class<ReturnedType> type)
-
Method Summary
-
Methods inherited from class com.kaltura.client.utils.request.RequestBuilderData
setApiVersion, setClientTag, setKs, setLanguage, setPartnerId, setResponseProfile, setSessionId
-
-
-
-
Field Detail
-
type
protected Class<ReturnedType> type
-
url
protected String url
-
files
protected Files files
-
connectionConfig
protected ConnectionConfiguration connectionConfig
-
onCompletion
protected OnCompletion<Response<ReturnedType>> onCompletion
callback for the parsed response.
-
-
Constructor Detail
-
BaseRequestBuilder
protected BaseRequestBuilder(Class<ReturnedType> type)
-
-
Method Detail
-
getUrlTail
protected abstract String getUrlTail()
-
getTag
public abstract String getTag()
- Specified by:
getTagin interfaceRequestElement<ReturnedType>
-
getType
public Class<?> getType()
-
getMethod
public String getMethod()
- Specified by:
getMethodin interfaceRequestElement<ReturnedType>
-
getBody
public String getBody()
- Specified by:
getBodyin interfaceRequestElement<ReturnedType>
-
getParams
protected Params getParams()
-
setFile
public BaseRequestBuilder<ReturnedType,SelfType> setFile(String key, FileHolder value)
-
getHeaders
public HashMap<String,String> getHeaders()
- Specified by:
getHeadersin interfaceRequestElement<ReturnedType>
-
getFiles
public Files getFiles()
- Specified by:
getFilesin interfaceRequestElement<ReturnedType>
-
setHeaders
public void setHeaders(String... nameValueHeaders)
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceRequestElement<ReturnedType>
-
getUrl
public String getUrl()
- Specified by:
getUrlin interfaceRequestElement<ReturnedType>
-
config
public ConnectionConfiguration config()
- Specified by:
configin interfaceRequestElement<ReturnedType>
-
prepareParams
protected Params prepareParams(Client configurations, boolean addSignature)
Builds the final list of parameters including the default params and the configured params.- Parameters:
configurations- client configurationsaddSignature- add signature- Returns:
- Params
-
prepareUrl
protected void prepareUrl(String endPoint)
-
build
public RequestElement<ReturnedType> build(Client client)
-
parseResponse
public final Response<ReturnedType> parseResponse(ResponseElement response)
- Specified by:
parseResponsein interfaceRequestElement<ReturnedType>
-
onComplete
public void onComplete(Response<ReturnedType> response)
- Specified by:
onCompletein interfaceRequestElement<ReturnedType>
-
parse
protected Object parse(String response) throws APIException
- Throws:
APIException
-
generateErrorResponse
protected APIException generateErrorResponse(ResponseElement response)
-
build
public RequestElement<ReturnedType> build(Client client, boolean addSignature)
-
prepareHeaders
protected void prepareHeaders(ConnectionConfiguration config)
-
-