Example usage for org.springframework.http HttpStatus BAD_REQUEST

List of usage examples for org.springframework.http HttpStatus BAD_REQUEST

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus BAD_REQUEST.

Prototype

HttpStatus BAD_REQUEST

To view the source code for org.springframework.http HttpStatus BAD_REQUEST.

Click Source Link

Document

400 Bad Request .

Usage

From source file:cz.fi.muni.pa036.airticketbooking.rest.handler.RestErrorHandler.java

@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ResponseBody/*from  w ww . j  av a 2  s . c om*/
public ValidationErrorDTO processValidationError(MethodArgumentNotValidException ex) {
    BindingResult result = ex.getBindingResult();
    List<FieldError> fieldErrors = result.getFieldErrors();

    return processFieldErrors(fieldErrors);
}

From source file:io.curly.commons.web.ModelErrors.java

@JsonCreator
public ModelErrors(Errors errors) {
    log.debug("New API Error status -- Errors {}", HttpStatus.BAD_REQUEST, errors.getObjectName());
    this.errors = new HashMap<>();
    this.errors.put(STATUS_CODE, HttpStatus.BAD_REQUEST.toString());
    errors.getAllErrors().forEach(//from  ww w  .  java 2s  .  c o m
            objectError -> this.errors.put(objectError.getObjectName(), objectError.getDefaultMessage()));
}

From source file:org.ff4j.spring.boot.exceptions.FF4jExceptionHandler.java

@ExceptionHandler(value = IllegalArgumentException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "bad request")
public void badRequestHandler() {
    // Not necessary to handle this exception
}

From source file:com.hillert.botanic.controller.BotanicControllerAdvice.java

@ExceptionHandler(value = Exception.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ResponseBody/*from www  . j a  v a2 s .c  om*/
public ErrorMessage errorResponse(Exception e) {
    return new ErrorMessage(new Date(), HttpStatus.BAD_REQUEST.value(), e.getClass().getName(), e.getMessage());
}

From source file:io.ignitr.dispatchr.manager.core.error.InvalidSortDirectionException.java

@Override
public HttpStatus getHttpStatus() {
    return HttpStatus.BAD_REQUEST;
}

From source file:com.ar.dev.tierra.api.controller.SexoController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Sexo> sexo = facadeService.getSexoDAO().getAll();
    if (!sexo.isEmpty()) {
        return new ResponseEntity<>(sexo, HttpStatus.OK);
    } else {//w  w w .  j  a  va 2s  .c  o  m
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:com.ar.dev.tierra.api.controller.MedioPagoController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<MedioPago> list = facadeService.getMedioPagoDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/*from   www.  ja  v  a2  s.c om*/
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:org.jug.bg.rest.hateoas.spring.common.resource.AbstractResource.java

/**
 * Handles bad request exception.//from w  w  w .  jav  a 2  s  .  com
 *
 * @param badRequestException Bad request exception.
 */
@ExceptionHandler()
@ResponseStatus(HttpStatus.BAD_REQUEST)
public void handle(BadRequestException badRequestException) {
    handleError(badRequestException, "Handling BAD REQUEST exception.");
}

From source file:com.hypersocket.auth.json.BootstrapResourceController.java

@ExceptionHandler(ResourceChangeException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public void resourceChangeError(HttpServletRequest request, HttpServletResponse response,
        ResourceChangeException e) {/*  ww w. ja  v a 2s  .  c om*/
    log.error("Resource change error", e);
}

From source file:com.bofa.sstradingreport.support.ExceptionHandlerAdvice.java

@ExceptionHandler(IllegalArgumentException.class)
public ResponseEntity<String> handleIllegalArgumentException(IllegalArgumentException e) throws Exception {
    return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
}