Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. @PutMapping(value = "/changeEmail", consumes = MediaType.APPLICATION_JSON_VALUE)
  2. public HttpEntity<ChangeEmailDTO> showChangeEMail(
  3. @RequestBody @Valid ChangeEmailDTO changeEmailDTO,
  4. BindingResult result
  5. ) {
  6. System.out.println("Email: " + changeEmailDTO.getEmail());
  7.  
  8. if(result.hasErrors()) {
  9. System.out.println("Error: " + changeEmailDTO.getEmail());
  10. return ResponseEntity.badRequest().body(changeEmailDTO);
  11. }
  12.  
  13. System.out.println("Success: " + changeEmailDTO.getEmail());
  14. return ResponseEntity.ok(changeEmailDTO);
  15. }
  16.  
  17. @NotEmpty
  18. @Getter @Setter private String email;
  19.  
  20. {"timestamp":1417379464584,"status":400,"error":"Bad Request","exception":"org.springframework.web.bind.MethodArgumentNotValidException","message":"Validation failed for argument at index 0 in method: public org.springframework.http.ResponseEntity<demo.AgencyResource> demo.AgencyController.saveAgency(demo.AgencyResource), with 2 error(s): [Field error in object 'agencyResource' on field 'name': rejected value [null]; codes [NotNull.agencyResource.name,NotNull.name,NotNull.java.lang.String,NotNull]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [agencyResource.name,name]; arguments []; default message [name]]; default message [may not be null]] [Field error in object 'agencyResource' on field 'id': rejected value [50]; codes [Max.agencyResource.id,Max.id,Max.java.lang.Integer,Max]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [agencyResource.id,id]; arguments []; default message [id],20]; default message [must be less than or equal to 20]] ","path":"/agencies"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement