Package com.cumulocity.sdk.client
Class RestConnector
- java.lang.Object
-
- com.cumulocity.sdk.client.RestConnector
-
- All Implemented Interfaces:
RestOperations,AutoCloseable
public class RestConnector extends Object implements RestOperations
-
-
Field Summary
Fields Modifier and Type Field Description static StringMIME_VERSIONprotected static StringTFA_TOKEN_HEADERstatic StringX_CUMULOCITY_APPLICATION_KEYstatic StringX_CUMULOCITY_REQUEST_ORIGIN
-
Constructor Summary
Constructors Modifier Constructor Description RestConnector(PlatformParameters platformParameters, ResponseParser responseParser)protectedRestConnector(PlatformParameters platformParameters, ResponseParser responseParser, javax.ws.rs.client.Client client)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static javax.ws.rs.client.ClientcreateClient(PlatformParameters platformParameters)static javax.ws.rs.client.ClientcreateURLConnectionClient(PlatformParameters platformParameters)voiddelete(String path)<T extends ResourceRepresentation>
Tget(String path, CumulocityMediaType mediaType, Class<T> responseType)javax.ws.rs.core.Responseget(String path, javax.ws.rs.core.MediaType mediaType)<T> Tget(String path, javax.ws.rs.core.MediaType mediaType, Class<T> responseType)javax.ws.rs.client.ClientgetClient()PlatformParametersgetPlatformParameters()ResponseParsergetResponseParser()javax.ws.rs.core.Response.StatusgetStatus(String path, CumulocityMediaType mediaType)booleanisClosed()<Result extends ResourceRepresentation,Param extends ResourceRepresentation>
Resultpost(String path, CumulocityMediaType contentType, CumulocityMediaType accept, Param representation, Class<Result> clazz)<T extends ResourceRepresentation>
Tpost(String path, javax.ws.rs.core.MediaType mediaType, T representation)<T extends ResourceRepresentation>
FuturepostAsync(String path, CumulocityMediaType mediaType, T representation)<T extends ResourceRepresentation>
TpostFile(String path, T representation, byte[] bytes, Class<T> responseClass)<T extends ResourceRepresentation>
TpostFileAsStream(String path, T representation, InputStream inputStream, Class<T> responseClass)<T extends ResourceRepresentation>
TpostStream(String path, CumulocityMediaType mediaType, InputStream content, Class<T> responseClass)<T extends ResourceRepresentation>
TpostText(String path, String content, Class<T> responseClass)<T extends ResourceRepresentation>
voidpostWithoutResponse(String path, javax.ws.rs.core.MediaType mediaType, T representation)<T extends ResourceRepresentationWithId>
Tput(String path, javax.ws.rs.core.MediaType mediaType, T representation)<T extends ResourceRepresentation>
FutureputAsync(String path, CumulocityMediaType mediaType, T representation)<T extends ResourceRepresentation>
TputStream(String path, String contentType, InputStream content, Class<T> responseClass)<T extends ResourceRepresentation>
TputStream(String path, javax.ws.rs.core.MediaType mediaType, InputStream content, Class<T> responseClass)<T extends ResourceRepresentation>
TputText(String path, String content, Class<T> responseClass)
-
-
-
Field Detail
-
X_CUMULOCITY_APPLICATION_KEY
public static final String X_CUMULOCITY_APPLICATION_KEY
- See Also:
- Constant Field Values
-
X_CUMULOCITY_REQUEST_ORIGIN
public static final String X_CUMULOCITY_REQUEST_ORIGIN
- See Also:
- Constant Field Values
-
MIME_VERSION
public static final String MIME_VERSION
- See Also:
- Constant Field Values
-
TFA_TOKEN_HEADER
protected static final String TFA_TOKEN_HEADER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RestConnector
public RestConnector(PlatformParameters platformParameters, ResponseParser responseParser)
-
RestConnector
protected RestConnector(PlatformParameters platformParameters, ResponseParser responseParser, javax.ws.rs.client.Client client)
-
-
Method Detail
-
getPlatformParameters
public PlatformParameters getPlatformParameters()
-
getClient
public javax.ws.rs.client.Client getClient()
-
getResponseParser
public ResponseParser getResponseParser()
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
isClosed
public boolean isClosed()
-
get
public <T extends ResourceRepresentation> T get(String path, CumulocityMediaType mediaType, Class<T> responseType) throws SDKException
- Specified by:
getin interfaceRestOperations- Throws:
SDKException
-
get
public <T> T get(String path, javax.ws.rs.core.MediaType mediaType, Class<T> responseType) throws SDKException
- Specified by:
getin interfaceRestOperations- Throws:
SDKException
-
get
public javax.ws.rs.core.Response get(String path, javax.ws.rs.core.MediaType mediaType)
-
getStatus
public javax.ws.rs.core.Response.Status getStatus(String path, CumulocityMediaType mediaType) throws SDKException
- Specified by:
getStatusin interfaceRestOperations- Throws:
SDKException
-
postStream
public <T extends ResourceRepresentation> T postStream(String path, CumulocityMediaType mediaType, InputStream content, Class<T> responseClass) throws SDKException
- Specified by:
postStreamin interfaceRestOperations- Throws:
SDKException
-
postText
public <T extends ResourceRepresentation> T postText(String path, String content, Class<T> responseClass)
- Specified by:
postTextin interfaceRestOperations
-
putText
public <T extends ResourceRepresentation> T putText(String path, String content, Class<T> responseClass)
- Specified by:
putTextin interfaceRestOperations
-
putStream
public <T extends ResourceRepresentation> T putStream(String path, String contentType, InputStream content, Class<T> responseClass)
- Specified by:
putStreamin interfaceRestOperations
-
putStream
public <T extends ResourceRepresentation> T putStream(String path, javax.ws.rs.core.MediaType mediaType, InputStream content, Class<T> responseClass)
- Specified by:
putStreamin interfaceRestOperations
-
postFile
public <T extends ResourceRepresentation> T postFile(String path, T representation, byte[] bytes, Class<T> responseClass)
- Specified by:
postFilein interfaceRestOperations
-
postFileAsStream
public <T extends ResourceRepresentation> T postFileAsStream(String path, T representation, InputStream inputStream, Class<T> responseClass)
- Specified by:
postFileAsStreamin interfaceRestOperations
-
put
public <T extends ResourceRepresentationWithId> T put(String path, javax.ws.rs.core.MediaType mediaType, T representation) throws SDKException
- Specified by:
putin interfaceRestOperations- Throws:
SDKException
-
postAsync
public <T extends ResourceRepresentation> Future postAsync(String path, CumulocityMediaType mediaType, T representation) throws SDKException
- Specified by:
postAsyncin interfaceRestOperations- Throws:
SDKException
-
putAsync
public <T extends ResourceRepresentation> Future putAsync(String path, CumulocityMediaType mediaType, T representation) throws SDKException
- Specified by:
putAsyncin interfaceRestOperations- Throws:
SDKException
-
post
public <T extends ResourceRepresentation> T post(String path, javax.ws.rs.core.MediaType mediaType, T representation) throws SDKException
- Specified by:
postin interfaceRestOperations- Throws:
SDKException
-
post
public <T extends ResourceRepresentationWithId> T post(String path, javax.ws.rs.core.MediaType mediaType, T representation) throws SDKException
- Specified by:
postin interfaceRestOperations- Throws:
SDKException
-
postWithoutResponse
public <T extends ResourceRepresentation> void postWithoutResponse(String path, javax.ws.rs.core.MediaType mediaType, T representation) throws SDKException
- Specified by:
postWithoutResponsein interfaceRestOperations- Throws:
SDKException
-
post
public <Result extends ResourceRepresentation,Param extends ResourceRepresentation> Result post(String path, CumulocityMediaType contentType, CumulocityMediaType accept, Param representation, Class<Result> clazz)
- Specified by:
postin interfaceRestOperations
-
put
public <T extends ResourceRepresentation> T put(String path, javax.ws.rs.core.MediaType mediaType, T representation) throws SDKException
- Specified by:
putin interfaceRestOperations- Throws:
SDKException
-
delete
public void delete(String path) throws SDKException
- Specified by:
deletein interfaceRestOperations- Throws:
SDKException
-
createClient
public static javax.ws.rs.client.Client createClient(PlatformParameters platformParameters)
-
createURLConnectionClient
public static javax.ws.rs.client.Client createURLConnectionClient(PlatformParameters platformParameters)
-
-