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:web.ClientsRESTController.java

/**
 * Lists all clients through a REST API/*from   w  w  w. j  a v a 2s .c o  m*/
 * @return
 */
@RequestMapping(value = "/api/clients/", method = RequestMethod.GET)
public ResponseEntity<List<Clients>> listClients() {
    List<Clients> clients = dao.getClientsList();
    //returns NO_CONTENT error if no Clients are provided
    if (clients.isEmpty()) {
        return new ResponseEntity<List<Clients>>(HttpStatus.NO_CONTENT);
    }
    //otherwise returns list of all Clients
    return new ResponseEntity<List<Clients>>(clients, HttpStatus.OK);
}

From source file:net.ljcomputing.core.controler.ClientLoggingController.java

/**
 * Log message from client.//  w ww.jav  a  2s  .c o m
 *
 * @param request
 *            the request
 * @param logMessage
 *            the log message
 */
@LogEvent(level = Level.WARN, message = "Received logging message from client")
@RequestMapping(method = RequestMethod.POST, consumes = { "application/json" })
@ResponseStatus(HttpStatus.NO_CONTENT)
public void logError(HttpServletRequest request, @RequestBody(required = true) LogMessage logMessage) {
    String ipAddress = request.getRemoteAddr();
    String hostname = request.getRemoteHost();
    logger.warn("Client-side log message ({}/{}) - using [{}] to request [{}]: {}", ipAddress, hostname,
            logMessage.getBrowser(), logMessage.getLocation(), logMessage.getPrintableMessage());
}

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

@Override
public ResponseEntity<Void> build() {
    ResponseEntity<Void> responseEntity;
    if (isCreate) {
        responseEntity = new ResponseEntity<Void>(this.headers, HttpStatus.CREATED);
    } else {/*w  w  w. j ava  2s. c  om*/
        responseEntity = new ResponseEntity<Void>(this.headers, HttpStatus.NO_CONTENT);
    }
    return responseEntity;
}

From source file:nl.surfnet.coin.api.ConfigurableApiController.java

@RequestMapping(value = { "/person" }, method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody/*from  w ww  .  j a  va  2s  .c o  m*/
public void addPerson(@RequestBody Person person) {
    LOG.info("Request to add Person");
    configurableGroupProvider.addPerson(person);
}

From source file:com.parivero.swagger.demo.controller.PaisController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void borrarPorId(@PathVariable("id") Long id) {
    if (id == 0) {
        throw new NotFoundException();
    }/*  w ww .j av  a 2  s . c om*/

}

From source file:com.thesoftwareguild.dvdlibrary.controller.HomeController.java

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

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

@RequestMapping(value = "/item/{id}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void putItem(@PathVariable("id") int id, @RequestBody Item item) {
    item.setItemId(id);// w  w  w  .j  a v a  2s. com
    dao.updateItem(item);

}

From source file:com.swcguild.capstoneproject.controller.PinnedPostController.java

@RequestMapping(value = "/pinpost/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deletePinPost(@PathVariable("id") int id) {

    dao.removePinPost(id);/*from  ww w .j  a va 2 s  . c  om*/

}

From source file:com.swcguild.capstoneproject.controller.AdminController.java

@RequestMapping(value = "/post/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deletePost(@PathVariable("id") int id) {

    dao.removePost(id);// w  w w.j a  va  2  s.com

}

From source file:com.trafficfine.controller.TrafficFineController.java

/**
 * //from   w  w  w  .  ja  v a2  s  .  c  o  m
 * @param initialDate
 * @param finalDate
 * @return
 */
@RequestMapping(value = "/api/infracao/busca", method = RequestMethod.GET)
public ResponseEntity<List<Infraction>> listAllTrafficFine(
        @RequestParam(value = "dataInicial") @DateTimeFormat(pattern = "dd/MM/yy") Date dataInicial,
        @RequestParam(value = "dataFinal") @DateTimeFormat(pattern = "dd/MM/yy") Date dataFinal) {
    List<Infraction> infractions = this.trafficFineService.findByRange(dataInicial, dataFinal);
    if (infractions.isEmpty()) {
        return new ResponseEntity<List<Infraction>>(HttpStatus.NO_CONTENT);
    }
    return new ResponseEntity<List<Infraction>>(infractions, HttpStatus.OK);
}