Klasse ProseoHttp

java.lang.Object
de.dlr.proseo.logging.http.ProseoHttp

public class ProseoHttp extends Object
A utility class for creating and parsing HTTP error headers.
Autor:
Katharina Bassler
  • Konstruktordetails

    • ProseoHttp

      public ProseoHttp(ProseoLogger logger, HttpPrefix prefix)
      Parameter:
      logger - The calling class's logger
      prefix - A prefix indicatimg the service
  • Methodendetails

    • errorHeaders

      public org.springframework.http.HttpHeaders errorHeaders(String loggedMessage)
      Create an HTTP "Warning" header with the given text message
      Parameter:
      loggedMessage - the message text
      Gibt zurück:
      an HttpHeaders object with a warning message
    • extractProseoMessage

      public String extractProseoMessage(String warningHeader)
      Extracts the prosEO-compliant message from the "Warning" header, if any
      Parameter:
      warningHeader - the warning header to check (may be null)
      Gibt zurück:
      the prosEO-compliant message, if there is one, or null otherwise
    • createMessageFromHeaders

      public String createMessageFromHeaders(org.springframework.http.HttpStatus httpStatus, org.springframework.http.HttpHeaders httpHeaders)
      Checks whether the error message from the "Warning" header is prosEO-compliant; if so, returns the error message from the header, otherwise generates a generic error message
      Parameter:
      httpStatus - the HTTP status returned by the REST call
      httpHeaders - the HTTP headers returned by the REST call
      Gibt zurück:
      a formatted error message