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:com.tsg.contactlistmvc.RESTController.java

@RequestMapping(value = "/contact/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteContact(@PathVariable("id") int id) {
    dao.removeContact(id);//from  ww  w .j  ava  2  s.c om

}

From source file:edu.mum.waa.webstore.controller.CartRestController.java

@RequestMapping(value = "/{cartId}", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void update(@PathVariable(value = "cartId") String cartId, @RequestBody Cart cart) {
    cartService.update(cartId, cart);//from   w  w  w.ja v a  2  s. co  m
}

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

@RequestMapping(value = "/user", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<User>> listUsers() {
    List<User> users = userService.listUsers();
    if (users.isEmpty()) {
        return new ResponseEntity<List<User>>(HttpStatus.NO_CONTENT);
    }/*from  ww w  .j  ava 2 s .  c  o m*/
    return new ResponseEntity<List<User>>(users, HttpStatus.OK);
}

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

@RequestMapping(value = { "/reset" }, method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody//from  w w  w  . j  a  v a2s .c o  m
public void reset() {
    log.debug("Resetting to default configuration");
    configuration.reset();
}

From source file:com.sg.addressbookmvc.HomeController.java

@RequestMapping(value = "/address/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteAddress(@PathVariable("id") int id) {
    dao.removeAddress(id);/*from  w  w w.j  a v a2s . co m*/
}

From source file:web.UsersRESTController.java

/**
 * Gets a list of users through a REST API
 * @return/*from   w w w  .  jav  a 2  s. co  m*/
 */
@RequestMapping(value = "/api/users/", method = RequestMethod.GET)
public ResponseEntity<List<Users>> listUsers() {
    List<Users> users = dao.getUsersList();
    //returns NO_CONTENT error if no Users are provided
    if (users.isEmpty()) {
        return new ResponseEntity<List<Users>>(HttpStatus.NO_CONTENT);
    }
    //otherwise returns list of all Users
    return new ResponseEntity<List<Users>>(users, HttpStatus.OK);
}

From source file:com.nazara.proxy.api.Endpoint.java

@RequestMapping(path = "/status", method = RequestMethod.GET)
@ResponseBody//from  ww  w .ja v a  2  s  . co m
public ResponseEntity<Object> proxyRequest(@RequestParam(value = "msisdn", required = false) String msisdn) {
    logger.info("status request arrived");
    try {
        HttpResponse<IPInfo> ipInfoResponse = Unirest.get("http://ipinfo.io/")
                .header("accept", "application/json").asObject(IPInfo.class);
        if (ipInfoResponse.getStatus() == 200) {
            return new ResponseEntity<Object>(ipInfoResponse.getBody(), HttpStatus.OK);
        }
    } catch (Exception exception) {
        logger.error("Error while processing proxy request {}", exception);
        return new ResponseEntity<Object>("NOK|ERR_CODE", HttpStatus.INTERNAL_SERVER_ERROR);
    }
    return new ResponseEntity<Object>("NOK|ERR_CODE", HttpStatus.NO_CONTENT);
}

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

@RequestMapping(value = "/dvd/{id}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void updateDvd(@PathVariable("id") int id, @Valid @RequestBody DVD dvd) {
    dvd.setDvdId(id);//w  ww .jav a2 s  .co m
    dao.updateDVD(dvd);

}

From source file:nu.yona.server.analysis.rest.AnalysisEngineController.java

@RequestMapping(value = "/userAnonymized/{userAnonymizedId}/networkActivity/", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void analyzeNetworkActivity(@PathVariable UUID userAnonymizedId,
        @RequestParam(value = "preventParallelism", required = false, defaultValue = "false") String preventParallelismStr,
        @RequestBody NetworkActivityDto potentialConflictPayload) {
    if (Boolean.TRUE.toString().equals(preventParallelismStr)) {
        analyzeSynchronized(userAnonymizedId, potentialConflictPayload);
    } else {//  ww  w. j a v a2 s  . co m
        analysisEngineService.analyze(userAnonymizedId, potentialConflictPayload);
    }
}

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

@RequestMapping(value = { "/ssoServiceURL" }, method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody//from  w  w w . j  av  a 2  s  .co  m
public void setSsoServiceURL(@RequestBody SSOServiceURL ssoServiceURL) {
    log.debug("Request to set ssoServiceURL to {}", ssoServiceURL.getValue());
    configuration.setSingleSignOnServiceURL(ssoServiceURL.getValue());
}