Klasse ServiceConnection
java.lang.Object
de.dlr.proseo.notification.service.ServiceConnection
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
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibung(Package privat) NotificationConfiguration
The configuration of the notification service -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungpostToService
(String endpoint, String user, String password, String subject, org.springframework.http.MediaType mediaType, String messageCode, String message, String sender) Constructs and sends an HTTP POST request to the specified endpoint, including the necessary authentication, headers, and message body.
-
Felddetails
-
config
The configuration of the notification service
-
-
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 addressuser
- The user name for basic HTTP authenticationpassword
- The password for basic HTTP authenticationsubject
- The message subjectmediaType
- The media type of the message bodymessageCode
- The message codemessage
- The message bodysender
- 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 serviceRuntimeException
- if the service returned an HTTP status different from OK (200)
-