Example usage for org.springframework.http ResponseEntity status

List of usage examples for org.springframework.http ResponseEntity status

Introduction

In this page you can find the example usage for org.springframework.http ResponseEntity status.

Prototype

Object status

To view the source code for org.springframework.http ResponseEntity status.

Click Source Link

Usage

From source file:br.com.s2it.snakes.controllers.CarController.java

@CrossOrigin("*")
@RequestMapping(value = "/damage/{licensePlate}", method = RequestMethod.PUT)
public ResponseEntity<Car> doDamage(final @RequestBody List<CarDamage> damage,
        final @PathVariable(value = "licensePlate") String licensePlate) {
    if (licensePlate == null || licensePlate.isEmpty() || damage == null)
        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);

    try {/*from  w  w w.  ja va2  s  .  c o  m*/
        Car car = service.findByLicensePlate(licensePlate);

        if (car.getDamages() == null)
            car.setDamages(new ArrayList<>());

        car.getDamages().addAll(damage);

        return ResponseEntity.status(HttpStatus.OK).body(service.save(car));
    } catch (Exception e) {
        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
    }
}

From source file:com.github.lynxdb.server.api.http.handlers.EpConfig.java

@RequestMapping(path = "/filters", method = { RequestMethod.GET,
        RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity filters() {
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}

From source file:com.github.lynxdb.server.api.http.handlers.EpTree.java

@RequestMapping(path = "/branch", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity branch() {
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}

From source file:com.github.lynxdb.server.api.http.handlers.EpUid.java

@RequestMapping(path = "/tsmeta", method = { RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT,
        RequestMethod.DELETE }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity tsmeta() {
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}

From source file:com.github.lynxdb.server.api.http.handlers.EpSearch.java

@RequestMapping(path = "/lookup", method = { RequestMethod.GET,
        RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity lookup() {
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}

From source file:com.github.lynxdb.server.api.http.handlers.EpAnnotation.java

@RequestMapping(path = "/bulk", method = { RequestMethod.POST, RequestMethod.PUT,
        RequestMethod.DELETE }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity bulk() {
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}

From source file:com.example.todo.api.common.error.RestGlobalExceptionHandler.java

@Override
protected ResponseEntity<Object> handleExceptionInternal(Exception ex, Object body, HttpHeaders headers,
        HttpStatus status, WebRequest request) {
    Object responseBody = body;//from   ww  w . j a v a2 s  . c  o m
    if (body == null) {
        responseBody = createApiError(request, "E999", ex.getMessage());
    }
    return ResponseEntity.status(status).headers(headers).body(responseBody);
}

From source file:de.codecentric.boot.admin.registry.web.RegistryController.java

/**
 * Register an application within this admin application.
 *
 * @param app The application infos.//from   www .  java2 s  .  c o  m
 * @return The registered application.
 */
@RequestMapping(value = "/api/applications", method = RequestMethod.POST)
public ResponseEntity<Application> register(@RequestBody Application app) {
    LOGGER.debug("Register application {}", app.toString());
    Application registeredApp = registry.register(app);
    return ResponseEntity.status(HttpStatus.CREATED).body(registeredApp);
}

From source file:feign.form.Server.java

@RequestMapping(value = "/form", method = POST)
public ResponseEntity<Void> form(@RequestParam("key1") String key1, @RequestParam("key2") String key2) {
    HttpStatus status = !key1.equals(key2) ? BAD_REQUEST : OK;
    return ResponseEntity.status(status).body(null);
}

From source file:com.github.lynxdb.server.api.http.handlers.EpStats.java

@RequestMapping(path = "/query", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity query() {
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}