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:nl.surfnet.mujina.controllers.IdentityProviderAPI.java

@RequestMapping(value = { "/users" }, method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody//w  w  w .java  2 s .com
public void addUser(@RequestBody User user) {
    log.debug("Request to add user {} with password {}", user.getName(), user.getPassword());
    final List<GrantedAuthority> grants = new ArrayList<GrantedAuthority>();
    final List<String> authorities = user.getAuthorities();
    for (String authority : authorities) {
        grants.add(new GrantedAuthorityImpl(authority));
    }
    SimpleAuthentication auth = new SimpleAuthentication(user.getName(), user.getPassword(), grants);
    configuration.getUsers().add(auth);
}

From source file:com.jee.shiro.rest.TaskRestController.java

@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = "applaction/json")
// Restful204??, . ?200??.
@ResponseStatus(HttpStatus.NO_CONTENT)
public void update(@RequestBody Task task) {
    // JSR303 Bean Validator, RestExceptionHandler?.
    BeanValidators.validateWithException(validator, task);

    // ?//from  ww  w. j a  v  a2s .  c  o  m
    taskService.saveTask(task);
}

From source file:org.jug.bg.rest.hateoas.spring.poll.resource.PollResource.java

@RequestMapping(value = "{id}", method = DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void removePoll(@PathVariable Long id) {
    repository.removePoll(id);
}

From source file:com.ge.predix.acs.commons.web.ResponseEntityBuilderTest.java

@Test
public void testDeleted() {
    ResponseEntity<Void> deleted = ResponseEntityBuilder.noContent();
    Assert.assertNotNull(deleted);/* w  w w  .j a  v  a2s . com*/
    Assert.assertNull(deleted.getBody());
    Assert.assertEquals(deleted.getStatusCode(), HttpStatus.NO_CONTENT);
}

From source file:cn.aozhi.songify.rest.TaskRestController.java

@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaTypes.JSON)
// Restful204??, . ?200??.
@ResponseStatus(HttpStatus.NO_CONTENT)
public void update(@RequestBody Task task) {
    // JSR303 Bean Validator, RestExceptionHandler?.
    BeanValidators.validateWithException(validator, task);

    // ?/* w w  w .  j  a  v a  2 s .  c o m*/
    taskService.saveTask(task);
}

From source file:org.branch.annotation.audio.web.controller.AnnotationController.java

@RequestMapping(value = "delete", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@Transactional// w  w w .j a va  2 s  . co m
public void delete(@RequestParam String id) {
    logger.info("**** deleting annotation id=" + id);

    annotationRepository.delete(id);
}

From source file:com.gazbert.bxbot.rest.api.MarketConfigController.java

@RequestMapping(value = "/market/{marketId}", method = RequestMethod.PUT)
ResponseEntity<?> updateMarket(@AuthenticationPrincipal User user, @PathVariable String marketId,
        @RequestBody MarketConfig config) {

    final MarketConfig updatedMarketConfig = marketConfigService.updateMarket(config);
    final HttpHeaders httpHeaders = new HttpHeaders();
    httpHeaders.setLocation(ServletUriComponentsBuilder.fromCurrentRequest().path("/{marketId}")
            .buildAndExpand(updatedMarketConfig.getId()).toUri());
    return new ResponseEntity<>(updatedMarketConfig, httpHeaders, HttpStatus.NO_CONTENT);
}

From source file:com.thesoftwareguild.capstoneblog.controller.UserController.java

@RequestMapping(value = "/user/{id}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void changePassword(@PathVariable("id") int id, @RequestBody User user) {

}

From source file:org.openbaton.nfvo.api.RestUsers.java

@RequestMapping(value = "/multipledelete", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void multipleDelete(@RequestBody @Valid List<String> ids) throws NotAllowedException {
    if (userManagement != null) {
        for (String id : ids) {
            log.info("removing User with id " + id);
            userManagement.delete(userManagement.queryById(id));
        }/*from  w  ww .ja v a  2s . c  o  m*/
    }
}

From source file:org.openbaton.nfvo.api.RestKeys.java

/**
 * Removes the Key from the key repository
 *
 * @param id : the id of the key to be removed
 *//*from  w w  w.j  a v a2 s  . com*/
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id, @RequestHeader(value = "project-id") String projectId)
        throws NotFoundException {
    keyManagement.delete(projectId, id);
}