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(MultiValueMap<String, String> headers, HttpStatus status) 

Source Link

Document

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

Usage

From source file:com.solace.demos.cloudfoundry.scaling.aggregator.controller.AggregatorController.java

@RequestMapping(value = "/jobs", method = RequestMethod.POST)
public ResponseEntity<String> createJobs(@RequestBody JobRequest jobRequest) {

    log.warn("Entering createJobs");
    try {// w  w  w . j a  v  a2s  .  co m
        solaceController.startJobRequest(jobRequest);
    } catch (Exception e) {
        log.error("Service Creation failed.", e);
        return new ResponseEntity<>("{'description': '" + e.getMessage() + "'}", HttpStatus.BAD_REQUEST);
    }
    return new ResponseEntity<>("{}", HttpStatus.OK);
}

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

@RequestMapping(value = "/user/{id}", method = RequestMethod.GET)
@ResponseBody/*ww  w.  j a  va2 s  .com*/
public ResponseEntity<List<Tiendas>> getTiendasByUser(@PathVariable("id") Integer id) {
    List<Tiendas> u = se.getTiendasByUser(id);
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:com.company.project.web.controller.TestController.java

@RequestMapping(value = "/responseEntity", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody//  w  w w  .  ja v a 2 s  .  c  om
//@Secured("ROLE_USER")
public ResponseEntity<String> responseEntityMap(final HttpServletRequest request) {
    Map<String, String> map = new HashMap<>();
    map.put("key1", "value1");
    map.put("key2", "value2");
    map.put("key3", "value3");

    String json = gson.toJson(map);

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

From source file:edu.sjsu.cmpe275.project.controller.OrderController.java

@RequestMapping(value = "", method = RequestMethod.GET)
public ResponseEntity<?> getAll() {
    return new ResponseEntity<Object>(orderService.getAll(), HttpStatus.OK);
}