Examples of UnprocessableEntityException


Examples of br.gov.frameworkdemoiselle.UnprocessableEntityException

  private transient Logger logger;

  @Override
  public Response toResponse(ConstraintViolationException exception) {
    UnprocessableEntityException failed = new UnprocessableEntityException();
    int status = new UnprocessableEntityException().getStatusCode();

    for (Iterator<ConstraintViolation<?>> iter = exception.getConstraintViolations().iterator(); iter.hasNext();) {
      ConstraintViolation<?> violation = iter.next();
      failed.addViolation(violation.getPropertyPath().toString(), violation.getMessage());
    }

    getLogger().debug(getBundle().getString("mapping-violations", status, failed.getViolations().toString()));
    return Response.status(status).entity(failed.getViolations()).build();
  }
View Full Code Here

Examples of br.gov.frameworkdemoiselle.UnprocessableEntityException

    response.close();
    assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode());
    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<UnprocessableEntityException.Violation>>() {
        });
    expected = new UnprocessableEntityException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
    bookmark.setLink("http: // google . com");
    request = new HttpPost(url + "/bookmark");
    request.setEntity(createEntity(bookmark));
    request.addHeader("Content-Type", "application/json");
    request.addHeader("Authorization", BASIC_CREDENTIALS);
    response = client.execute(request);
    response.close();
    assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode());
    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<UnprocessableEntityException.Violation>>() {
        });
    expected = new UnprocessableEntityException().addViolation("link", "formato inválido");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setId(Long.valueOf(123456789));
    bookmark.setDescription("Test");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.UnprocessableEntityException

    response.close();
    assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode());
    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<UnprocessableEntityException.Violation>>() {
        });
    expected = new UnprocessableEntityException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
    bookmark.setLink("http: // google . com");
    request = new HttpPut(url + "/bookmark/" + id);
    request.setEntity(createEntity(bookmark));
    request.addHeader("Content-Type", "application/json");
    request.addHeader("Authorization", BASIC_CREDENTIALS);
    response = client.execute(request);
    response.close();
    assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode());
    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<UnprocessableEntityException.Violation>>() {
        });
    expected = new UnprocessableEntityException().addViolation("link", "formato inválido");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setId(Long.valueOf(123456789));
    bookmark.setDescription("Test");
View Full Code Here

Examples of ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException

    case Constants.STATUS_HTTP_412_PRECONDITION_FAILED:
      throw new ResourceVersionNotSpecifiedException("Server responded with: " + IOUtils.toString(theResponseReader));
    case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
      IParser parser = createAppropriateParser(theResponseMimeType, theResponseReader, theResponseStatusCode);
      OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
      throw new UnprocessableEntityException(operationOutcome);
    default:
      throw new UnclassifiedServerFailureException(theResponseStatusCode, IOUtils.toString(theResponseReader));
    }

  }
View Full Code Here

Examples of ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException

      ex = new ResourceVersionNotSpecifiedException("Server responded with HTTP 412");
      break;
    case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
      IParser parser = createAppropriateParserForParsingResponse(theResponseMimeType, theResponseReader, theStatusCode);
      OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
      ex = new UnprocessableEntityException(operationOutcome);
      break;
    default:
      ex = new UnclassifiedServerFailureException(theStatusCode, "Server responded with HTTP " + theStatusCode);
      break;
    }
View Full Code Here

Examples of ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException

      ex = new ResourceVersionNotSpecifiedException("Server responded with HTTP 412");
      break;
    case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
      IParser parser = createAppropriateParserForParsingResponse(theResponseMimeType, theResponseReader, theStatusCode);
      OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
      ex = new UnprocessableEntityException(operationOutcome);
      break;
    default:
      ex = new UnclassifiedServerFailureException(theStatusCode, "Server responded with HTTP " + theStatusCode);
      break;
    }
View Full Code Here

Examples of ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException

      ex = new ResourceVersionNotSpecifiedException("Server responded with HTTP 412");
      break;
    case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
      IParser parser = createAppropriateParserForParsingResponse(theResponseMimeType, theResponseReader, theStatusCode);
      OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
      ex = new UnprocessableEntityException(operationOutcome);
      break;
    default:
      ex = new UnclassifiedServerFailureException(theStatusCode, "Server responded with HTTP " + theStatusCode);
      break;
    }
View Full Code Here

Examples of ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException

    case Constants.STATUS_HTTP_412_PRECONDITION_FAILED:
      throw new ResourceVersionNotSpecifiedException("Server responded with: " + IOUtils.toString(theResponseReader));
    case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
      IParser parser = createAppropriateParser(theResponseMimeType, theResponseReader, theResponseStatusCode);
      OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
      throw new UnprocessableEntityException(operationOutcome);
    default:
      throw new UnclassifiedServerFailureException(theResponseStatusCode, IOUtils.toString(theResponseReader));
    }

  }
View Full Code Here

Examples of ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException

      ex = new ResourceVersionNotSpecifiedException("Server responded with HTTP 412");
      break;
    case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
      IParser parser = createAppropriateParserForParsingResponse(theResponseMimeType, theResponseReader, theStatusCode);
      OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
      ex = new UnprocessableEntityException(operationOutcome);
      break;
    default:
      ex = new UnclassifiedServerFailureException(theStatusCode, "Server responded with HTTP " + theStatusCode);
      break;
    }
View Full Code Here

Examples of com.cloudesire.tisana4j.exceptions.UnprocessableEntityException

    case 403:
      return new AccessDeniedException(responseCode, msgError);
    case 404:
      return new ResourceNotFoundException(responseCode, msgError);
    case 422:
      return new UnprocessableEntityException(responseCode, msgError);
    case 500:
      return new InternalServerErrorException(responseCode, msgError);
    }
    return new RestException(responseCode, msgError);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.