Klasse ServiceConnection

java.lang.Object
de.dlr.proseo.notification.service.ServiceConnection

@Service public class ServiceConnection extends Object
The HTTP service to post the message. This service is responsible for sending an HTTP POST request to a specified endpoint, providing the necessary authentication, headers, and message body.
Autor:
Ernst Melchinger
  • Felddetails

  • Konstruktordetails

    • ServiceConnection

      public ServiceConnection()
  • Methodendetails

    • postToService

      public Object postToService(String endpoint, String user, String password, String subject, org.springframework.http.MediaType mediaType, String messageCode, String message, String sender) throws org.springframework.web.client.RestClientException, RuntimeException
      Constructs and sends an HTTP POST request to the specified endpoint, including the necessary authentication, headers, and message body. It handles exceptions and returns appropriate response entities based on the HTTP status codes received.
      Parameter:
      endpoint - The HTTP address
      user - The user name for basic HTTP authentication
      password - The password for basic HTTP authentication
      subject - The message subject
      mediaType - The media type of the message body
      messageCode - The message code
      message - The message body
      sender - The message sender
      Gibt zurück:
      The response entity
      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)