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.bozzo.ipplan.web.ZoneController.java

@RequestMapping(value = "/{zoneId}", method = RequestMethod.DELETE)
public @ResponseStatus(HttpStatus.NO_CONTENT) void deleteZone(@PathVariable Integer infraId,
        @PathVariable Long zoneId) {
    logger.info("delete zone with id: {} (infra id: {})", zoneId, infraId);
    this.repository.deleteByInfraIdAndId(infraId, zoneId);
}

From source file:com.expedia.seiso.web.controller.v1.ItemControllerV1.java

/**
 * Handles HTTP PUT requests against top-level resources. Following HTTP semantics, this creates the resource if it
 * doesn't already exist; otherwise, it completely replaces the existing resource (as opposed to merging it). With
 * respect to the latter, null and missing fields in the incoming representation map to null fields in the
 * persistent resource./*  w  ww.j  a  v a  2  s.  c om*/
 * 
 * @param repoKey
 *            Repository key
 * @param itemKey
 *            Item key
 * @param peResource
 *            Item to save
 */
@RequestMapping(value = "/{repoKey}/{itemKey}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void put(@PathVariable String repoKey, @PathVariable String itemKey, PEResource peResource) {
    delegate.put(peResource.getItem(), true);
}

From source file:com.jiwhiz.rest.admin.UserRestController.java

@RequestMapping(method = RequestMethod.PATCH, value = URL_ADMIN_USERS_USER)
@Transactional/*from  ww  w . j a  v  a 2  s  . c om*/
public HttpEntity<Void> updateUserAccount(@PathVariable("userId") String userId,
        @RequestBody Map<String, String> updateMap) throws ResourceNotFoundException {
    String command = updateMap.get("command");
    UserAccount user = getUserByUserId(userId);

    if ("lock".equals(command)) {
        user.setAccountLocked(true);
        userAccountRepository.save(user);
    } else if ("unlock".equals(command)) {
        user.setAccountLocked(false);
        userAccountRepository.save(user);
    } else if ("trust".equals(command)) {
        user.setTrustedAccount(true);
        userAccountRepository.save(user);
    } else if ("untrust".equals(command)) {
        user.setTrustedAccount(false);
        userAccountRepository.save(user);
    } else if ("addAuthorRole".equals(command)) {
        userAccountService.addRole(userId, UserRoleType.ROLE_AUTHOR);
    } else if ("removeAuthorRole".equals(command)) {
        userAccountService.removeRole(userId, UserRoleType.ROLE_AUTHOR);
    }

    return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
}

From source file:org.nekorp.workflow.backend.controller.imp.AutoControllerImp.java

@Override
@RequestMapping(value = "/{numeroSerie}", method = RequestMethod.DELETE)
public void borrarAuto(@PathVariable final String numeroSerie, final HttpServletResponse response) {
    Auto dato = this.autoDAO.consultar(this.stringStandarizer.standarize(numeroSerie));
    if (dato == null) {
        //no hay nada que responder
        response.setStatus(HttpStatus.NO_CONTENT.value());
        return;/*  www . j  a  v  a 2 s  .co m*/
    }
    autoDAO.borrar(dato);
    //se acepto la peticion de borrado, no quiere decir que sucede de inmediato.
    response.setStatus(HttpStatus.ACCEPTED.value());
}

From source file:net.navasoft.madcoin.backend.services.controller.BusinessController.java

@ExceptionHandler(InsufficientLOBException.class)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
private @ResponseBody FailedResponseVO handleNoLOBs(BusinessControllerException e) {
    FailedResponseVO value = new BusinessFailedResponseVO();
    value.setErrorMessage(e.getMessage());
    value.setCauses(e.getCauses());//from  w  ww  .j a  v  a  2 s.  c om
    value.setTip(e.formulateTips());
    return value;
}

From source file:com.expedia.seiso.web.controller.v1.ItemControllerV1.java

@RequestMapping(value = "/{repoKey}/{itemKey}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@SuppressWarnings("rawtypes")
public void delete(@PathVariable String repoKey, @PathVariable String itemKey) {
    val itemClass = itemMetaLookup.getItemClass(repoKey);
    delegate.delete(new SimpleItemKey(itemClass, itemKey));
}

From source file:web.ClientsRESTController.java

/**
 * Deletes a client from the database through a REST API
 * @param id/*from w  w  w.j av  a2 s.  c o m*/
 * @return
 */
@RequestMapping(value = "/api/clients/clientinfo/{id}", method = RequestMethod.DELETE)
public ResponseEntity<Clients> deleteClient(@PathVariable("id") int id) {
    Clients client = null;
    //gets Client info.  Returns NOT_FOUND error if no Client exists
    try {
        client = dao.getClientByID(id);
    } catch (EmptyResultDataAccessException ex) {
        return new ResponseEntity<Clients>(HttpStatus.NOT_FOUND);
    }
    //otherwise returns NO_CONTENT status after deletion
    dao.deleteClient(id);
    return new ResponseEntity<Clients>(HttpStatus.NO_CONTENT);
}

From source file:com.wisemapping.rest.AdminController.java

@ApiOperation("Note: Administration permissions required.")
@RequestMapping(method = RequestMethod.DELETE, value = "admin/users/{id}")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void deleteUserByEmail(@PathVariable long id) throws WiseMappingException {
    final User user = userService.getUserBy(id);
    if (user == null) {
        throw new IllegalArgumentException("User '" + id + "' could not be found");
    }//w  w  w .  ja va  2  s .  c om

    final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
    for (Collaboration collaboration : collaborations) {
        final Mindmap mindmap = collaboration.getMindMap();
        mindmapService.removeMindmap(mindmap, user);
    }

    userService.removeUser(user);
}

From source file:nc.noumea.mairie.organigramme.core.ws.BaseWsConsumer.java

public <T> T readResponseWithReturnMessageDto(Class<T> targetClass, ClientResponse response, String url) {

    T result = null;/*w  w w  .  ja v a 2 s . c  o m*/

    try {
        result = targetClass.newInstance();
    } catch (Exception ex) {
        throw new WSConsumerException(
                "An error occured when instantiating return type when deserializing JSON from SIRH ABS WS request.",
                ex);
    }

    if (response.getStatus() == HttpStatus.NO_CONTENT.value()) {
        return null;
    }

    if (response.getStatus() == HttpStatus.INTERNAL_SERVER_ERROR.value()) {
        return null;
    }

    String output = response.getEntity(String.class);
    result = new JSONDeserializer<T>().use(Date.class, new MSDateTransformer()).deserializeInto(output, result);
    return result;
}

From source file:com.sothawo.taboo2.Taboo2Service.java

/**
 * deletes a bookmark from the repository.
 *
 * @param id/*w  w w  .j  ava  2  s  .com*/
 *         id of the bookmark to delete
 * @throws NotFoundException
 *         when no Bookmarks is found for the id
 */
@RequestMapping(value = MAPPING_BOOKMARKS + "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public final void deleteBookmarkById(@PathVariable(value = "id") final String id) {
    repository.deleteBookmark(id);
    LOG.info("deleted bookmark with id {}", id);
}