protected Result<Resource> getResourceResult(RestResponse response)
     throws JsonParseException, JsonMappingException, IOException {
   Object resultContents = null;
   if (response.getHttpStatus() == 200) resultContents = new Resource(response);
   else resultContents = wrapNonUnmarshallableResponseWithPOJO(response);
   return new Result<Resource>(resultContents);
 }
 public ResultWithErrors(RestResponse response) {
   httpStatusCode = response.getHttpStatus();
   httpHeaders = response.wrapHeaders();
 }
 @Override
 protected Object wrapNonUnmarshallableResponseWithPOJO(RestResponse r)
     throws UnsupportedEncodingException {
   return new Errors(
       new Error(ErrorCodes.CANT_UNMARSHAL_RESPONSE, r.toString(), r.getHttpStatus()));
 }