Klasse ServiceConnection

java.lang.Object
de.dlr.proseo.ui.backend.ServiceConnection

@Service public class ServiceConnection extends Object
Service class to connect to the prosEO backend services from the user interface
Autor:
Dr. Thomas Bassler
  • 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 parameters
      clazz - the class of the return object
      username - 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 service
      RuntimeException - 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 parameters
      clazz - the class of the return object
      username - 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 service
      RuntimeException - 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 parameters
      restObject - the object to post to the service
      clazz - the class of the expected result object
      username - 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 service
      RuntimeException - 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 parameters
      restObject - the object to patch to the service
      clazz - the class of the expected result object
      username - 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 service
      RuntimeException - 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 parameters
      username - 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