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:de.sainth.recipe.backend.rest.controller.FoodController.java

@Secured("ROLE_ADMIN")
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
void delete(@PathVariable("id") Long id) {
    repository.delete(id);/*from   ww  w.ja v  a 2  s . com*/
}

From source file:net.eusashead.hateoas.conditional.interceptor.SyncTestController.java

@RequestMapping(method = RequestMethod.PUT)
public ResponseEntity<Void> put() {
    HttpHeaders headers = new HttpHeaders();
    headers.setETag("\"123456\"");
    return new ResponseEntity<Void>(headers, HttpStatus.NO_CONTENT);
}

From source file:com.mum.controller.CardRestController.java

@RequestMapping(value = "/{cardId}", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void update(@PathVariable(value = "cardId") String cardId, @RequestBody Card card) {
    System.out.println("Update");
    cardServiceImpl.update(cardId, card);

}

From source file:com.tsg.cms.TagController.java

@RequestMapping(value = "/tag/{oldTagName}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody//from  w  ww. j av a  2  s .  co  m
public TagContainer updateTag(@PathVariable("oldTagName") String oldTagName, @RequestBody String newTag) {

    TagContainer tagContainer = new TagContainer();

    tagContainer.setTagName(tagDao.updateTag(newTag, oldTagName));

    return tagContainer;
}

From source file:com.xpanxion.userprojecthibernate.controllers.RESTController.java

@RequestMapping(value = "/user/{id}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void putUser(@PathVariable("id") int id, @RequestBody UserBean userToUpdate) {
    userToUpdate.setId(id);//from w  w  w .j av a 2  s. c  o  m
    userService.updateUser(userToUpdate);
}

From source file:net.eusashead.hateoas.response.impl.HeadResponseBuilderImplTest.java

@Test
public void testEntityBuild() throws Exception {
    Entity entity = new Entity("foo");
    ResponseEntity<Entity> response = builder.entity(entity).build();
    Assert.assertNotNull(response);//  w  w w  . j a v a  2 s  . c o m
    Assert.assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
    Assert.assertNull(response.getBody());
    Assert.assertNull(response.getHeaders().getETag());
    Assert.assertEquals(-1l, response.getHeaders().getLastModified());
    Assert.assertNull(response.getHeaders().getCacheControl());
    Assert.assertEquals(-1l, response.getHeaders().getExpires());
    Assert.assertEquals(-1l, response.getHeaders().getDate());
}

From source file:com.mycompany.springrest.controllers.RoleController.java

@RequestMapping(value = "/role", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Role>> listRoles() {
    List<Role> roles = roleService.listRoles();
    if (roles.isEmpty()) {
        return new ResponseEntity<List<Role>>(HttpStatus.NO_CONTENT);
    }//w  ww. java 2s . c  o  m
    return new ResponseEntity<List<Role>>(roles, HttpStatus.OK);
}

From source file:nl.surfnet.mujina.controllers.IdentityProviderAPI.java

@RequestMapping(value = { "/attributes" }, method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody//  w  ww  . j a va 2s  .  c om
public void setAttributes(@RequestBody AttributesMap attribues) {
    log.debug("Request to replace all attributes");
    configuration.getAttributes().clear();
    for (String name : attribues.keySet()) {
        Attribute attribute = attribues.get(name);
        configuration.getAttributes().put(name, attribute.getValue());
    }
}

From source file:org.zols.datastore.web.controller.PageController.java

@RequestMapping(value = "/api/pages/{name}", method = PUT)
@ApiIgnore/*from w  w  w .j av  a  2 s .  com*/
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void update(@PathVariable(value = "name") String name, @RequestBody Page page) {
    LOGGER.info("Updating pages with id {} with {}", name, page);
    if (name.equals(page.getName())) {
        pageManager.update(page);
    }
}

From source file:com.tsg.contactlistmvc.RESTController.java

@RequestMapping(value = "/contact/{id}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void updateContact(@PathVariable("id") int id, @Valid @RequestBody Contact contact) {
    contact.setContactId(id);/*from   www .j  a  v  a 2s.  c om*/
    dao.updateContact(contact);

}