Package org.bremersee.exception
Class RestApiExceptionParserImpl
java.lang.Object
org.bremersee.exception.RestApiExceptionParserImpl
- All Implemented Interfaces:
RestApiExceptionParser
The default implementation of a http response parser that creates a
RestApiException.- Author:
- Christian Bremer
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new rest api exception parser.RestApiExceptionParserImpl(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper) Instantiates a new rest api exception parser.RestApiExceptionParserImpl(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper, Charset defaultCharset) Instantiates a new rest api exception parser.RestApiExceptionParserImpl(Charset defaultCharset) Instantiates a new rest api exception parser.RestApiExceptionParserImpl(org.springframework.http.converter.json.Jackson2ObjectMapperBuilder objectMapperBuilder) Instantiates a new rest api exception parser.RestApiExceptionParserImpl(org.springframework.http.converter.json.Jackson2ObjectMapperBuilder objectMapperBuilder, Charset charset) Instantiates a new rest api exception parser. -
Method Summary
Modifier and TypeMethodDescriptionprotected CharsetgetContentTypeCharset(org.springframework.http.MediaType contentType) Gets content type charset.protected CharsetGets default charset.protected org.bremersee.exception.model.RestApiExceptiongetRestApiExceptionFromHeaders(String response, org.springframework.http.HttpStatusCode httpStatus, org.springframework.http.HttpHeaders httpHeaders) Gets rest api exception from headers.protected OffsetDateTimeparseErrorTimestamp(String value) Parse the 'timestamp' header value.org.bremersee.exception.model.RestApiExceptionparseException(byte[] response, org.springframework.http.HttpStatusCode httpStatus, org.springframework.http.HttpHeaders headers) Parse exception.org.bremersee.exception.model.RestApiExceptionparseException(String response, org.springframework.http.HttpStatusCode httpStatus, org.springframework.http.HttpHeaders headers) Parse exception.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bremersee.exception.RestApiExceptionParser
parseException
-
Constructor Details
-
RestApiExceptionParserImpl
public RestApiExceptionParserImpl()Instantiates a new rest api exception parser. -
RestApiExceptionParserImpl
Instantiates a new rest api exception parser.- Parameters:
defaultCharset- the default charset
-
RestApiExceptionParserImpl
public RestApiExceptionParserImpl(org.springframework.http.converter.json.Jackson2ObjectMapperBuilder objectMapperBuilder) Instantiates a new rest api exception parser.- Parameters:
objectMapperBuilder- the object mapper builder
-
RestApiExceptionParserImpl
public RestApiExceptionParserImpl(org.springframework.http.converter.json.Jackson2ObjectMapperBuilder objectMapperBuilder, Charset charset) Instantiates a new rest api exception parser.- Parameters:
objectMapperBuilder- the object mapper buildercharset- the charset
-
RestApiExceptionParserImpl
public RestApiExceptionParserImpl(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper) Instantiates a new rest api exception parser.- Parameters:
objectMapper- the object mapperxmlMapper- the xml mapper
-
RestApiExceptionParserImpl
public RestApiExceptionParserImpl(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper, Charset defaultCharset) Instantiates a new rest api exception parser.- Parameters:
objectMapper- the object mapperxmlMapper- the xml mapperdefaultCharset- the default charset
-
-
Method Details
-
getDefaultCharset
Gets default charset.- Returns:
- the default charset
-
parseException
public org.bremersee.exception.model.RestApiException parseException(byte[] response, org.springframework.http.HttpStatusCode httpStatus, org.springframework.http.HttpHeaders headers) Description copied from interface:RestApiExceptionParserParse exception.- Specified by:
parseExceptionin interfaceRestApiExceptionParser- Parameters:
response- the responsehttpStatus- the http statusheaders- the headers- Returns:
- the parsed exception
-
parseException
public org.bremersee.exception.model.RestApiException parseException(String response, org.springframework.http.HttpStatusCode httpStatus, org.springframework.http.HttpHeaders headers) Description copied from interface:RestApiExceptionParserParse exception.- Specified by:
parseExceptionin interfaceRestApiExceptionParser- Parameters:
response- the responsehttpStatus- the http statusheaders- the headers- Returns:
- the parsed exception
-
getRestApiExceptionFromHeaders
protected org.bremersee.exception.model.RestApiException getRestApiExceptionFromHeaders(String response, org.springframework.http.HttpStatusCode httpStatus, org.springframework.http.HttpHeaders httpHeaders) Gets rest api exception from headers.- Parameters:
response- the responsehttpStatus- the http statushttpHeaders- the http headers- Returns:
- the rest api exception from headers
-
getContentTypeCharset
Gets content type charset.- Parameters:
contentType- the content type- Returns:
- the content type charset
-
parseErrorTimestamp
Parse the 'timestamp' header value.- Parameters:
value- the 'timestamp' header value- Returns:
- the timestamp
-