Example usage for org.springframework.http ResponseEntity ResponseEntity

List of usage examples for org.springframework.http ResponseEntity ResponseEntity

Introduction

In this page you can find the example usage for org.springframework.http ResponseEntity ResponseEntity.

Prototype

public ResponseEntity(HttpStatus status) 

Source Link

Document

Create a new ResponseEntity with the given status code, and no body nor headers.

Usage

From source file:biz.dfch.activiti.wrapper.controller.ProcessInvocationController.java

@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)/*w w  w . ja  v  a 2  s  .  c o m*/
public ResponseEntity<Void> invokeProcess(@Valid @RequestBody ProcessMetadata processMetadata) {
    LOG.info("POST /process-invocation called");
    try {
        LOG.debug(objectMapper.writeValueAsString(processMetadata));
    } catch (JsonProcessingException e) {
        LOG.error("Conversion of request body to JSON failed", e);
    }
    activitiService.invokeProcess(processMetadata);
    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:br.com.hyperclass.snackbar.restapi.MenuController.java

@RequestMapping(value = "/menu", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<ProductWrapper> registerProduct(@RequestBody final ProductWrapper productWrapper) {
    final Product product = new Product(productWrapper.getName(), productWrapper.getPrice());
    menu.addProductMenu(product);/*www.  ja  v  a  2s. com*/
    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:com.tribuo.backend.controllers.EspecificosController.java

/**
 *
 * @param p/*  w w  w .  jav  a 2 s. co m*/
 * @return
 */
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public ResponseEntity<Void> insertSubcategoria(@RequestBody Especificos p) {
    se.insertEspecifico(p);
    return new ResponseEntity<>(HttpStatus.CREATED);
}

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

@RequestMapping(method = RequestMethod.DELETE)
public ResponseEntity<Void> delete() {
    return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
}

From source file:com.budiana.irpan.belajar.controller.PesertaController.java

@RequestMapping(value = "/peserta/{id}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)//  w w w .  ja  v a 2s.c  om
public ResponseEntity<Peserta> cariPesertaById(@PathVariable("id") String id) {

    Peserta hasil = pd.findOne(id);
    if (hasil == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
    return new ResponseEntity<Peserta>(hasil, HttpStatus.OK);
}

From source file:com.wordnik.springmvc.UserResource.java

@RequestMapping(method = RequestMethod.POST)
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", position = 1)
public ResponseEntity createUser(@ApiParam(value = "Created user object", required = true) User user,
        String arbitraryString) {
    userData.addUser(user);//from  ww w. j a  va2 s  . co m
    return new ResponseEntity(HttpStatus.OK);
}

From source file:net.oneandone.stool.overview.ProcessesController.java

@RequestMapping(value = "{id}", method = RequestMethod.GET)
@ResponseBody//from  w ww.  ja va  2  s.co  m
public ResponseEntity state(@PathVariable(value = "id") String id) throws IOException {
    Node stat;
    String stoolProcess;

    stat = logs.join(id + ".stat");
    if (!stat.exists()) {
        return new ResponseEntity(HttpStatus.NOT_FOUND);
    }

    stoolProcess = stat.readString();
    return new ResponseEntity(stoolProcess, HttpStatus.OK);

}

From source file:com.sms.server.controller.MediaController.java

@RequestMapping(value = "/folder/{id}", method = RequestMethod.GET)
public ResponseEntity<MediaFolder> getMediaFolder(@PathVariable("id") Long id) {
    MediaFolder mediaFolder = settingsDao.getMediaFolderByID(id);

    if (mediaFolder == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }//www.  j  a v a2s  .  co  m

    return new ResponseEntity<>(mediaFolder, HttpStatus.OK);
}

From source file:com.basicservice.controller.GeneralController.java

@RequestMapping(method = RequestMethod.GET)
@ResponseBody// w w  w.j av a  2s. c om
public ResponseEntity<String> runTest(HttpServletResponse response) {
    LOG.debug("Starting test write to db");
    boolean success = service.initReadWriteTest();
    LOG.debug("DB test write results: " + success);
    return new ResponseEntity<String>(success ? HttpStatus.OK : HttpStatus.SERVICE_UNAVAILABLE);
}

From source file:fr.gmjgav.controller.ReportController.java

@RequestMapping(value = "/{barId}/{beerId}", method = POST)
public ResponseEntity<?> post(@PathVariable long barId, @PathVariable long beerId) {
    Bar bar = barRepository.findOne(barId);
    Beer beer = beerRepository.findOne(beerId);
    if (reportRepository.findByBarIdAndBeerId(barId, beerId).isEmpty()) {
        Report report = new Report(bar, beer);
        reportRepository.save(report);/*w  w w  .  jav a2 s  .c  o m*/
        return new ResponseEntity<>(HttpStatus.CREATED);
    }
    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}