class JaxrsProducerResponseMapper implements ProducerResponseMapper {

  @Override
  public Response mapResponse(StatusType status, Object response) {
    javax.ws.rs.core.Response jaxrsResponse = (javax.ws.rs.core.Response) response;

    Response cseResponse = Response.status(jaxrsResponse.getStatusInfo()).entity(jaxrsResponse.getEntity());
    MultivaluedMap<String, Object> headers = jaxrsResponse.getHeaders();
    for (Entry<String, List<Object>> entry : headers.entrySet()) {
      if (entry.getValue() == null || entry.getValue().isEmpty()) {
        continue;
      }

      cseResponse.getHeaders().addHeader(entry.getKey(), entry.getValue());
    }
    return cseResponse;
  }

}