Example usage for org.springframework.http ResponseEntity noContent

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

Introduction

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

Prototype

public static HeadersBuilder<?> noContent() 

Source Link

Document

Create a builder with a HttpStatus#NO_CONTENT NO_CONTENT status.

Usage

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

@RequestMapping(value = "/{userLogin}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity deleteUser(Authentication _authentication, @PathVariable("userLogin") String userLogin) {

    User user = users.byLogin(userLogin);
    if (user == null) {
        return new ErrorResponse(mapper, HttpStatus.BAD_REQUEST, "User does not exist.", null).response();
    }/*from   ww w.  ja v  a2 s  .  c  o  m*/

    users.delete(user);

    return ResponseEntity.noContent().build();
}

From source file:com.crossover.trial.weather.endpoint.RestWeatherCollectorEndpoint.java

@Transactional
@RequestMapping(path = "/collect/airport/{iata}", method = DELETE)
@ApiResponses({ @ApiResponse(code = 204, message = "No Content"),
        @ApiResponse(code = 404, message = "Not Found"), @ApiResponse(code = 400, message = "Bad Request") })
public ResponseEntity<Void> deletAirport(@PathVariable("iata") IATA iata) {

    if (!airportRepository.exists(iata))
        return ResponseEntity.notFound().build();

    dataPointRepository.deleteAllMeasurements(iata);
    airportRepository.delete(iata);/*  ww w .  j a  va  2s  .  co m*/

    return ResponseEntity.noContent().build();
}

From source file:org.openlmis.fulfillment.web.TransferPropertiesController.java

/**
 * Allows deleting transfer properties./*from   w w  w .j  av a2 s .c o  m*/
 *
 * @param id UUID of transfer properties which we want to delete
 * @return ResponseEntity containing the HTTP Status
 */
@RequestMapping(value = "/transferProperties/{id}", method = RequestMethod.DELETE)
public ResponseEntity delete(@PathVariable("id") UUID id) {

    LOGGER.debug("Checking right to delete transfer properties");
    permissionService.canManageSystemSettings();

    TransferProperties toDelete = transferPropertiesRepository.findOne(id);

    if (toDelete == null) {
        return ResponseEntity.notFound().build();
    } else {
        transferPropertiesRepository.delete(toDelete);
        return ResponseEntity.noContent().build();
    }
}

From source file:com.haulmont.idp.controllers.IdpController.java

@GetMapping(value = "/status", produces = "application/json; charset=UTF-8")
public ResponseEntity status(
        @CookieValue(value = CUBA_IDP_COOKIE_NAME, defaultValue = "") String idpSessionCookie) {
    if (!Strings.isNullOrEmpty(idpSessionCookie)) {
        String serviceProviderTicket = idpService.createServiceProviderTicket(idpSessionCookie);
        if (serviceProviderTicket != null) {
            return ResponseEntity.ok(new IdpTicket(serviceProviderTicket));
        }//from w w w.j a  v  a  2s  .co m
    }

    return ResponseEntity.noContent().build();
}

From source file:com.pablinchapin.anacleto.mongodb.controller.UserController.java

@RequestMapping(method = RequestMethod.PUT)
@ApiOperation(value = "Update a user", notes = "Updates user passed")
public ResponseEntity<Void> updateUser(@RequestBody @Valid User user) {
    log.info("update user" + user.getUserId());

    usersService.updateUser(user);/*from w  w  w  .j  a va  2 s.c  o m*/

    return ResponseEntity.noContent().build();
}

From source file:com.pablinchapin.anacleto.mongodb.controller.UserController.java

@RequestMapping(value = "/{userId}", method = RequestMethod.DELETE)
@ApiOperation(value = "Delete a user", notes = "Delete a user by userId")
public ResponseEntity<Void> deleteUser(@PathVariable String userId) {
    log.info("Delete user " + userId);
    usersService.deleteUser(userId);//  ww  w  . j a v a  2  s  .c  o m

    return ResponseEntity.noContent().build();
}

From source file:org.talend.dataprep.preparation.service.PreparationService.java

public ResponseEntity<Void> preparationsThatUseDataset(final String datasetId) {
    final boolean preparationUseDataSet = preparationRepository.exist(Preparation.class,
            "dataSetId = '" + datasetId + "'");
    final boolean dataSetUsedInLookup = isDatasetUsedToLookupInPreparationHead(datasetId);
    if (!preparationUseDataSet && !dataSetUsedInLookup) {
        return ResponseEntity.notFound().build();
    }/*w  ww . j  av  a 2s  .c  om*/
    return ResponseEntity.noContent().build();
}