Package de.dlr.proseo.ui.backend
Klasse ServiceConnection
java.lang.Object
de.dlr.proseo.ui.backend.ServiceConnection
Service class to connect to the prosEO backend services from the user interface
- Autor:
- Dr. Thomas Bassler
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
deleteFromService
(String serviceUrl, String requestPath, String username, String password) Calls a prosEO service at the given location with HTTP DELETE<T> T
getFromService
(String serviceUrl, String requestPath, Class<T> clazz, String username, String password) Calls a prosEO service at the given location with HTTP GET<T> T
patchToService
(String serviceUrl, String requestPath, Object restObject, Class<T> clazz, String username, String password) Calls a prosEO service at the given location with HTTP Patch<T> T
postToService
(String serviceUrl, String requestPath, Object restObject, Class<T> clazz, String username, String password) Calls a prosEO service at the given location with HTTP Post<T> T
putToService
(String serviceUrl, String requestPath, Class<T> clazz, String username, String password) Calls a prosEO service at the given location with HTTP PUT
-
Konstruktordetails
-
ServiceConnection
public ServiceConnection()
-
-
Methodendetails
-
getFromService
public <T> T getFromService(String serviceUrl, String requestPath, Class<T> clazz, String username, String password) throws org.springframework.web.client.RestClientException, RuntimeException Calls a prosEO service at the given location with HTTP GET- Typparameter:
T
- the class of the REST object to return- Parameter:
serviceUrl
- the base URL of the service (protocol, hostname, port, base URI)requestPath
- the specific request path including request parametersclazz
- the class of the return objectusername
- the username for basic HTTP authentication (optional)password
- the password for basic HTTP authentication (optional)- Gibt zurück:
- the body of the HTTP response converted into an object of the expected class
- Löst aus:
org.springframework.web.client.RestClientException
- if an error (HTTP status code 4xx or 5xx) occurred in the communication to the serviceRuntimeException
- if the service returned an HTTP status different from OK (200)
-
putToService
public <T> T putToService(String serviceUrl, String requestPath, Class<T> clazz, String username, String password) throws org.springframework.web.client.RestClientException, RuntimeException Calls a prosEO service at the given location with HTTP PUT- Typparameter:
T
- the class of the REST object to use as PUT data- Parameter:
serviceUrl
- the base URL of the service (protocol, hostname, port, base URI)requestPath
- the specific request path including request parametersclazz
- the class of the return objectusername
- the username for basic HTTP authentication (optional)password
- the password for basic HTTP authentication (optional)- Gibt zurück:
- the body of the HTTP response converted into an object of the expected class
- Löst aus:
org.springframework.web.client.RestClientException
- if an error (HTTP status code 4xx or 5xx) occurred in the communication to the serviceRuntimeException
- if the service returned an HTTP status different from OK (200)
-
postToService
public <T> T postToService(String serviceUrl, String requestPath, Object restObject, Class<T> clazz, String username, String password) throws org.springframework.web.client.RestClientException, RuntimeException Calls a prosEO service at the given location with HTTP Post- Typparameter:
T
- the class of the REST object to use as POST data- Parameter:
serviceUrl
- the base URL of the service (protocol, hostname, port, base URI)requestPath
- the specific request path including request parametersrestObject
- the object to post to the serviceclazz
- the class of the expected result objectusername
- the username for basic HTTP authentication (optional)password
- the password for basic HTTP authentication (optional)- Gibt zurück:
- the body of the HTTP response converted into an object of the expected class
- Löst aus:
org.springframework.web.client.RestClientException
- if an error (HTTP status code 4xx or 5xx) occurred in the communication to the serviceRuntimeException
- if the service returned an HTTP status different from OK (200)
-
patchToService
public <T> T patchToService(String serviceUrl, String requestPath, Object restObject, Class<T> clazz, String username, String password) throws org.springframework.web.client.RestClientException, RuntimeException Calls a prosEO service at the given location with HTTP Patch- Typparameter:
T
- the class of the REST object to use as PATCH data- Parameter:
serviceUrl
- the base URL of the service (protocol, hostname, port, base URI)requestPath
- the specific request path including request parametersrestObject
- the object to patch to the serviceclazz
- the class of the expected result objectusername
- the username for basic HTTP authentication (optional)password
- the password for basic HTTP authentication (optional)- Gibt zurück:
- the body of the HTTP response converted into an object of the expected class
- Löst aus:
org.springframework.web.client.RestClientException
- if an error (HTTP status code 4xx or 5xx) occurred in the communication to the serviceRuntimeException
- if the service returned an HTTP status different from OK (200) or another unrecoverable error occurred
-
deleteFromService
public void deleteFromService(String serviceUrl, String requestPath, String username, String password) throws org.springframework.web.client.RestClientException Calls a prosEO service at the given location with HTTP DELETE- Parameter:
serviceUrl
- the base URL of the service (protocol, hostname, port, base URI)requestPath
- the specific request path including request parametersusername
- the username for basic HTTP authentication (optional)password
- the password for basic HTTP authentication (optional)- Löst aus:
org.springframework.web.client.RestClientException
- if an error (HTTP status code 304, 4xx or 5xx) occurred in the communication to the service
-