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.aws.brian.web.TriggerController.java

@ResponseBody
@RequestMapping(value = "/scheduler/start", method = RequestMethod.PUT)
public ResponseEntity<?> startScheduler() throws SchedulerException {
    scheduler.start();/* w  ww  .  java  2s.c om*/
    logger.info("start");
    return ResponseEntity.ok(new BrianResponse<>(true, "ok"));
}

From source file:jp.classmethod.aws.brian.web.TriggerController.java

@ResponseBody
@RequestMapping(value = "/scheduler/standby", method = RequestMethod.PUT)
public ResponseEntity<?> standbyScheduler() throws SchedulerException {
    scheduler.standby();/*from ww  w.  j  a v a  2s  .  co  m*/
    logger.info("standby");
    return ResponseEntity.ok(new BrianResponse<>(true, "ok"));
}

From source file:com.leqcar.interfaces.command.ValetCommandController.java

@RequestMapping(method = RequestMethod.PUT, path = "/{valetId}/cancel")
public ResponseEntity<ValetResponse> cancelValetRequest(@PathVariable("valetId") String valetId) {
    LOG.log(Level.INFO, "-- cancelling request ---");

    ValetResponse response = valetCommandService.cancelRequest(valetId);
    response.add(linkTo(ValetCommandController.class).slash(response.getValetId()).withSelfRel());
    return ResponseEntity.ok(response);
}

From source file:com.leqcar.interfaces.command.ValetCommandController.java

@RequestMapping(method = RequestMethod.POST, path = "/{valetId}/accept")
public ResponseEntity<ValetResponse> acceptValetRequest(@PathVariable("valetId") String valetId,
        @RequestBody @Valid ValetAttendantInfo valetAttendantInfo) {

    LOG.log(Level.INFO, "--- accepting request ---");
    Validate.notNull(valetAttendantInfo);

    ValetResponse response = valetCommandService.acceptRequest(valetId,
            createValetAttendant(valetAttendantInfo));

    response.add(linkTo(ValetCommandController.class).slash(response.getValetId()).withSelfRel());

    response.add(/*from ww w  .  ja v  a  2s. c om*/
            linkTo(ValetCommandController.class).slash(response.getTicketNumber()).withRel("claim-ticket"));

    response.add(linkTo(methodOn(ValetCommandController.class).cancelValetRequest(response.getValetId()))
            .withRel("cancel"));

    return ResponseEntity.ok(response);
}

From source file:com.leqcar.interfaces.command.ValetCommandController.java

@RequestMapping(method = RequestMethod.POST, path = "/{valetId}/confirm")
public ResponseEntity<ValetResponse> confirm(@PathVariable("valetId") String valetId,
        @RequestBody @Valid CoordinatesInfo coordinatesInfo) {

    Validate.notNull(coordinatesInfo, "CoordinateInfo should not be null");

    valetCommandService.confirm(valetId, coordinatesInfo);
    return ResponseEntity.ok(null);
}

From source file:com.pablinchapin.anacleto.mongodb.controller.UserController.java

@RequestMapping(method = RequestMethod.GET)
@ApiOperation(value = "Find all users", notes = "Return all users available")
public ResponseEntity<List<User>> usersAll() {
    log.info("Get All users");
    return ResponseEntity.ok(usersService.findAll());
}

From source file:com.pablinchapin.anacleto.mongodb.controller.UserController.java

@RequestMapping(value = "/{userId}", method = RequestMethod.GET)
@ApiOperation(value = "Find a user", notes = "Return a user by userId")
public ResponseEntity<User> userById(@PathVariable String userId) throws UserNotFoundException {
    log.info("Get userById");
    try {//from   www .j a va2  s .c om
        user = usersService.findByUserId(userId);
    } catch (UserNotFoundException e) {
        log.warn(e);
        user = null;
    }
    return ResponseEntity.ok(user);
}

From source file:com.pablinchapin.anacleto.mongodb.controller.UserController.java

@RequestMapping(method = RequestMethod.POST)
@ApiOperation(value = "Create a user", notes = "Create a new user")
public ResponseEntity<User> saveUser(@RequestBody @Valid User user) {
    log.info("Save new user");
    return ResponseEntity.ok(usersService.saveUser(user));
}

From source file:com.thinkenterprise.Application.java

@RequestMapping("/helloWorld")
public ResponseEntity<String> index() {
    logger.info("Das ist meine Logausgabe");
    return ResponseEntity.ok("Hello World");
}

From source file:com.thinkenterprise.Application.java

@RequestMapping("/getEnvironemtService")
public ResponseEntity<String> getEnvironmentService() {
    return ResponseEntity.ok(environmentService.getEnvironment());
}