Package de.dlr.proseo.logging.http
Class ProseoHttp
java.lang.Object
de.dlr.proseo.logging.http.ProseoHttp
A utility class for creating and parsing HTTP error headers.
- Author:
- Katharina Bassler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateMessageFromHeaders(org.springframework.http.HttpStatusCode httpStatusCode, 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 messageorg.springframework.http.HttpHeaderserrorHeaders(String loggedMessage) Create an HTTP "Warning" header with the given text messageextractProseoMessage(String warningHeader) Extracts the prosEO-compliant message from the "Warning" header, if any
-
Constructor Details
-
ProseoHttp
- Parameters:
logger- The calling class's loggerprefix- A prefix indicatimg the service
-
-
Method Details
-
errorHeaders
Create an HTTP "Warning" header with the given text message- Parameters:
loggedMessage- the message text- Returns:
- an HttpHeaders object with a warning message
-
extractProseoMessage
Extracts the prosEO-compliant message from the "Warning" header, if any- Parameters:
warningHeader- the warning header to check (may be null)- Returns:
- the prosEO-compliant message, if there is one, or null otherwise
-
createMessageFromHeaders
public String createMessageFromHeaders(org.springframework.http.HttpStatusCode httpStatusCode, 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- Parameters:
httpStatusCode- the HTTP status returned by the REST callhttpHeaders- the HTTP headers returned by the REST call- Returns:
- a formatted error message
-