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.obiba.mica.web.rest.LogsResource.java

@PUT
@Timed/*from  ww  w .j  a v a  2s  .  c om*/
public HttpStatus changeLevel(LoggerDTO jsonLogger) {
    @SuppressWarnings("TypeMayBeWeakened")
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel()));
    return HttpStatus.NO_CONTENT;
}

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

@RequestMapping(value = "/dvd/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteDvd(@PathVariable("id") int id) {
    dao.removeDVD(id);/*from w w  w .  j  av a  2 s  .  c om*/

}

From source file:com.musala.controller.SitesController.java

@RequestMapping(value = { SITE_DELETE }, method = RequestMethod.DELETE)
@ResponseBody//from  w  w w  .jav a2  s. c o  m
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void delete(@PathVariable String deleteSite) {
    siteService.delete(deleteSite);
}

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

@RequestMapping(value = "/tag/{tagName}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteTag(@PathVariable("tagName") String tagName) {
    tagDao.removeTag(tagName);/*  w  w  w  . ja  v a2s  .  c  om*/
}

From source file:com.swcguild.vendingmachinemvc.controller.UserController.java

@RequestMapping(value = "/item/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteItem(@PathVariable("id") int id) {
    dao.removeItem(id);/*from   w w  w .j  a va  2  s.co m*/

}

From source file:za.ac.cput.project.universalhardwarestorev2.api.ItemApi.java

@RequestMapping(value = "/items/", method = RequestMethod.GET)
public ResponseEntity<List<Item>> listAllItems() {
    List<Item> Items = service.findAll();
    if (Items.isEmpty()) {
        return new ResponseEntity<List<Item>>(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND
    }//  w w  w.  ja va2  s  .  c  om
    return new ResponseEntity<List<Item>>(Items, HttpStatus.OK);
}

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

@RequestMapping(value = "/{workMode}/{linkId}", method = RequestMethod.PUT)
@ResponseBody// w  ww . j av a2s .  com
public ResponseEntity<?> changeWorkMode(@PathVariable Integer linkId, @PathVariable WorkMode workMode) {
    try {
        linkControlService.changeWorkMode(linkId, workMode);
        return new ResponseEntity<String>(HttpStatus.NO_CONTENT);
    } catch (LinkStatusException e) {
        return new ResponseEntity<String>(e.getMessage(), HttpStatus.METHOD_NOT_ALLOWED);
    }
}

From source file:com._8x8.presentation.restController.UserRestController.java

@RequestMapping(value = "/users/", method = RequestMethod.GET)
public ResponseEntity<List<User>> listAllUsers() {

    List<User> users = _userService.GetUsers();//  .findAllUsers();

    if (users.isEmpty()) {
        return new ResponseEntity<List<User>>(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND
    }/* ww w.j a  v  a 2 s.  c om*/
    return new ResponseEntity<List<User>>(users, HttpStatus.OK);
}

From source file:web.EventLogRESTController.java

/**
 * Gets a list of events in the Event Log
 * @return/* w w  w  .  j  a v a 2 s. c o m*/
 */
@RequestMapping(value = "/api/eventlog/", method = RequestMethod.GET)
public ResponseEntity<List<EventLog>> listEventLog() {
    List<EventLog> el = dao.getEventsList();
    //returns NO_CONTENT error if no Events are provided
    if (el.isEmpty()) {
        return new ResponseEntity<List<EventLog>>(HttpStatus.NO_CONTENT);
    }
    //otherwise returns list of all Events
    return new ResponseEntity<List<EventLog>>(el, HttpStatus.OK);
}

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

@Test
public void testBuild() throws Exception {
    ResponseEntity<Void> response = builder.build();
    Assert.assertNotNull(response);//  w  ww . j av a 2 s .c om
    Assert.assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
    Assert.assertNull(response.getBody());
    Assert.assertNull(response.getHeaders().getLocation());
    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());
}