Example usage for org.springframework.http ResponseEntity ok

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

Introduction

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

Prototype

public static <T> ResponseEntity<T> ok(T body) 

Source Link

Document

A shortcut for creating a ResponseEntity with the given body and the status set to HttpStatus#OK OK .

Usage

From source file:jp.classmethod.example.berserker.web.RootController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public ResponseEntity<?> index(Model model) {
    log.debug("index");
    return ResponseEntity.ok("index");
}

From source file:com.github.jmnarloch.spring.cloud.feign.app.resource.InvoiceResource.java

@RequestMapping(value = "invoices", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Invoice>> getInvoices() {

    return ResponseEntity.ok(createInvoiceList(100));
}

From source file:com.sundy.controller.HelloController.java

@RequestMapping("/home")
@ResponseBody/*w w w  .j  a va2s . co m*/
public ResponseEntity home() throws IOException, InterruptedException {
    String result = service.hello("test");
    System.out.println("#############  spring boot call motan result: " + result);
    return ResponseEntity.ok(result);
}

From source file:com.example.web.NewRestController.java

@RequestMapping(value = "/{id}", method = GET)
public ResponseEntity<?> get(@PathVariable Long id) {
    Student student = studentRepository.findOne(id);
    if (student != null) {
        return ResponseEntity.ok(student);
    }/*from   w w w  .ja  v  a2s .c om*/
    return ResponseEntity.notFound().build();
}

From source file:com.orange.clara.pivotaltrackermirror.controllers.TaskStatusController.java

@ApiOperation(value = "Get the current status of the job running for a specific mirror", response = JobStatus.class)
@RequestMapping(method = RequestMethod.GET, value = "/{id}/status", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getStatus(@PathVariable Integer id) throws SchedulerException {
    return ResponseEntity.ok(this.getTriggerState(id));
}

From source file:de.document.controller.ProzedurController.java

@RequestMapping(value = "/{name}", method = { RequestMethod.GET })
public ResponseEntity read(@PathVariable("name") String name) {

    Prozedur entity = this.service.read(name);
    return ResponseEntity.ok(entity);
}

From source file:com.greglturnquist.RootController.java

@RequestMapping(value = "/info")
ResponseEntity<?> info() {//from  w ww .  j av a 2s .com

    ResourceSupport info = new ResourceSupport();

    info.add(entityLinks.linkToSingleResource(Employee.class, 1).withRel("employee 1"));
    info.add(entityLinks.linkToCollectionResource(Employee.class).withRel("All employees"));

    return ResponseEntity.ok(info);
}

From source file:org.zalando.logbook.servlet.example.ExampleController.java

@RequestMapping("/sync")
public ResponseEntity<Message> message() {
    final Message message = new Message();
    message.setValue("Hello, world!");
    return ResponseEntity.ok(message);
}

From source file:cn.edu.zjnu.acm.judge.controller.ProblemController.java

@GetMapping(value = "{id}", produces = APPLICATION_JSON_VALUE)
public ResponseEntity<?> findOne(@PathVariable("id") long id, Locale locale) {
    Problem problem = problemMapper.findOne(id, locale.getLanguage());
    return problem != null ? ResponseEntity.ok(problem) : ResponseEntity.notFound().build();
}