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:io.onedecision.engine.OneDecisionExceptionHandler.java

@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = NoDmnFileInUploadException.MESSAGE)
@ExceptionHandler(NoDmnFileInUploadException.class)
public void handleBadRequest(Exception e) {
    LOGGER.error(e.getMessage(), e);// w  ww . j  ava2  s  .c  om
}

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

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

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<PlanPago> list = facadeService.getPlanPagoDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {// w w  w.  jav  a2 s . c om
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Cliente> list = facadeService.getClienteDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/* w  w  w.  j  a  v  a2  s  .  co m*/
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:com.hp.autonomy.frontend.find.idol.web.IdolGlobalExceptionHandler.java

@ExceptionHandler(AutoCorrectException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ResponseBody//from  w ww.  ja  v  a 2s  . c  o  m
public SpellingErrorResponse invalidSpellingCorrection(final AutoCorrectException e) {
    return new SpellingErrorResponse(e.getMessage(), e.getSpelling());
}

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

@ExceptionHandler(value = FeatureIdBlankException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "feature uid cannot be blank")
public void featureIdBlankException() {
    // Not necessary to handle this exception
}

From source file:br.com.porao.ui.ControllerVenda.java

@RequestMapping(value = "/venda/add", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> addVenda(Venda venda) {
    try {/*w w w  .  ja va 2  s.c  o m*/
        this.fachada.cadastrarVenda(venda);
        return new ResponseEntity<String>(HttpStatus.OK);
    } catch (VendaExistenteException vendaexistente) {
        return new ResponseEntity<VendaExistenteException>(vendaexistente, HttpStatus.BAD_REQUEST);
    }
}

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

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Tarjeta> categorias = facadeService.getTarjetaDAO().getAll();
    if (!categorias.isEmpty()) {
        return new ResponseEntity<>(categorias, HttpStatus.OK);
    } else {/*from ww w. j a  va2 s  .c  o  m*/
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:com.profiles.rest.RestExceptionHandler.java

@ExceptionHandler(value = { ConstraintViolationException.class })
public final ResponseEntity<?> handleException(ConstraintViolationException ex, WebRequest request) {
    Map<String, String> errors = BeanValidators.extractPropertyAndMessage(ex.getConstraintViolations());
    String body = jsonMapper.toJson(errors);
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.TEXT_PLAIN);
    return handleExceptionInternal(ex, body, null, HttpStatus.BAD_REQUEST, request);
}

From source file:com.github.iexel.fontus.web.rest.GlobalControllerAdviceRest.java

@ResponseBody
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(BindException.class)
public AjaxError handle(BindException ex, Locale locale) {

    BindingResult bindingResult = ex.getBindingResult();
    AjaxError ajaxError = new AjaxError();
    ajaxError.setValidationErrors(fetchValidationErrorsAsStringArray(bindingResult, locale));
    ajaxError.setLocalErrorMessage(fetchErrorMessage("jggrid_validation_error_message", locale));
    return ajaxError;
}