Example usage for org.springframework.http HttpStatus NO_CONTENT

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

Introduction

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

Prototype

HttpStatus NO_CONTENT

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

Click Source Link

Document

204 No Content .

Usage

From source file:org.ff4j.spring.boot.utilts.FeatureWebUtils.java

public static ResponseEntity<Boolean> getBooleanResponseEntityByHttpStatus(FeatureActions featureActions) {
    switch (featureActions) {
    case CREATED:
        return new ResponseEntity<>(TRUE, HttpStatus.CREATED);
    case UPDATED:
        return new ResponseEntity<>(TRUE, HttpStatus.ACCEPTED);
    default:/*from w  w  w.  j  a  v a  2  s  .c  om*/
        return new ResponseEntity<>(FALSE, HttpStatus.NO_CONTENT);
    }
}

From source file:com.carlomicieli.jtrains.infrastructure.web.Responses.java

public static ResponseEntity<Void> noContent() {
    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

From source file:com.hp.autonomy.frontend.find.core.stats.StatsController.java

@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void stats(@RequestBody final Event event) {
    statsService.recordEvent(event);
}

From source file:rest.UsuarioRestController.java

@RequestMapping(value = "/usuarios/", method = RequestMethod.GET)
public ResponseEntity<List<UsuarioBean>> listAll() {
    List<UsuarioBean> usuarios = usuarioService.findAll();
    if (usuarios.isEmpty()) {
        return new ResponseEntity<List<UsuarioBean>>(HttpStatus.NO_CONTENT);
    }/*from  ww w. j a v  a2 s. c  o m*/
    return new ResponseEntity<List<UsuarioBean>>(usuarios, HttpStatus.OK);
}

From source file:com.tsguild.vendingmachinewebapp.controller.HomeController.java

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(value = "/items/{id}", method = RequestMethod.PUT)
public void updateItem(@PathVariable("id") int itemId, @RequestBody Item item) {
    item.setId(itemId);/*from  w w w . j  av  a 2  s. co m*/
    dao.updateItem(item);
}

From source file:uk.gov.hscic.common.config.DefaultControllerExceptionHandler.java

@ResponseStatus(HttpStatus.NO_CONTENT)
@ExceptionHandler(DataNotFoundException.class)
public String handleDataNotFoundException(final DataNotFoundException ex) {
    return ex.getMessage();
}

From source file:nu.yona.server.rest.ControllerBase.java

protected <T> ResponseEntity<T> createNoContentResponse() {
    return createResponse(HttpStatus.NO_CONTENT);
}

From source file:com.baidu.terminator.manager.action.RecordAction.java

@RequestMapping(value = "/{linkId}/{version}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteRecord(@PathVariable int linkId, @PathVariable int version) {
    try {// ww w .j  a va  2 s. com
        recordService.deleteRecord(linkId, version);
        return new ResponseEntity<String>(HttpStatus.NO_CONTENT);
    } catch (LinkStatusException e) {
        return new ResponseEntity<String>(e.getMessage(), HttpStatus.METHOD_NOT_ALLOWED);
    }
}

From source file:io.syndesis.runtime.T3stSupportITCase.java

@Test
public void createAndGetIntegration() {

    // Reset to fresh startup state..
    get("/api/v1/test-support/reset-db", null, tokenRule.validToken(), HttpStatus.NO_CONTENT);

    // We should have some initial data in the snapshot since we start up with deployment.json
    @SuppressWarnings({ "unchecked", "rawtypes" })
    Class<ModelData<?>[]> type = (Class) ModelData[].class;
    ResponseEntity<ModelData<?>[]> r1 = get("/api/v1/test-support/snapshot-db", type);
    assertThat(r1.getBody().length).isGreaterThan(1);

    // restoring to no data should.. leave us with no data.
    ModelData<?>[] NO_DATA = new ModelData[] {};
    post("/api/v1/test-support/restore-db", NO_DATA, (Class<?>) null, tokenRule.validToken(),
            HttpStatus.NO_CONTENT);/*from w ww. j  av a2s .c o m*/

    // Lets add an integration...
    Integration integration = new Integration.Builder().id("2001").name("test")
            .desiredStatus(Integration.Status.Draft).currentStatus(Integration.Status.Draft).build();
    post("/api/v1/integrations", integration, Integration.class);

    // Snapshot should only contain the integration entity..
    ResponseEntity<ModelData<?>[]> r2 = get("/api/v1/test-support/snapshot-db", type);
    assertThat(r2.getBody().length).isEqualTo(1);

    // Reset to fresh startup state..
    get("/api/v1/test-support/reset-db", null, tokenRule.validToken(), HttpStatus.NO_CONTENT);

    // Verify that the new state has the same number of entities as the original
    ResponseEntity<ModelData<?>[]> r3 = get("/api/v1/test-support/snapshot-db", type);
    assertThat(r3.getBody().length).isEqualTo(r1.getBody().length);

    // restoring 1 item of data
    post("/api/v1/test-support/restore-db", r2.getBody(), (Class<?>) null, tokenRule.validToken(),
            HttpStatus.NO_CONTENT);

    // Snapshot should only contain the integration entity..
    ResponseEntity<ModelData<?>[]> r4 = get("/api/v1/test-support/snapshot-db", type);
    assertThat(r4.getBody().length).isEqualTo(1);

}

From source file:com._8x8.presentation.restfulController.GCMRestController.java

@RequestMapping(value = "/gcm/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<GCM>> getAllGCM() {
    List<GCM> GCMs = _gcmService.GetGCMs();

    if (GCMs.isEmpty()) {
        return new ResponseEntity<List<GCM>>(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND
    }//from   w  w  w.j av  a  2  s .c om
    return new ResponseEntity<List<GCM>>(GCMs, HttpStatus.OK);
}