class SpringmvcProducerResponseMapper implements ProducerResponseMapper {

  @SuppressWarnings("unchecked")
  @Override
  public Response mapResponse(StatusType status, Object response) {
    ResponseEntity<Object> springmvcResponse = (ResponseEntity<Object>) response;

    StatusType responseStatus = new HttpStatus(springmvcResponse.getStatusCode().value(),
        springmvcResponse.getStatusCode().getReasonPhrase());

    Response cseResponse = null;
    if (HttpStatus.isSuccess(responseStatus)) {
      cseResponse = realMapper.mapResponse(responseStatus, springmvcResponse.getBody());
    } else {
      // not support fail response mapper now
      cseResponse = Response.status(responseStatus).entity(springmvcResponse.getBody());
    }

    HttpHeaders headers = springmvcResponse.getHeaders();
    Headers cseHeaders = cseResponse.getHeaders();
    for (Entry<String, List<String>> entry : headers.entrySet()) {
      if (entry.getValue() == null || entry.getValue().isEmpty()) {
        continue;
      }

      for (String value : entry.getValue()) {
        cseHeaders.addHeader(entry.getKey(), value);
      }
    }
    return cseResponse;
  }

  public  SpringmvcProducerResponseMapper(ProducerResponseMapper realMapper);

}