Example usage for org.springframework.http HttpStatus OK

List of usage examples for org.springframework.http HttpStatus OK

Introduction

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

Prototype

HttpStatus OK

To view the source code for org.springframework.http HttpStatus OK.

Click Source Link

Document

200 OK .

Usage

From source file:nu.yona.server.batch.rest.BatchTaskController.java

@RequestMapping(value = "/sendSystemMessage/", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public void sendSystemMessage(@RequestBody SystemMessageSendRequestDto systemMessageSendRequest) {
    batchTaskService.sendSystemMessage(systemMessageSendRequest);
}

From source file:org.khmeracademy.btb.auc.pojo.controller.Bid_log_controller.java

@RequestMapping(value = "/get", method = RequestMethod.GET, produces = "application/json")
@ResponseBody//from  w w w.  ja va  2  s.  com
public ResponseEntity<Map<String, Object>> getNumberOfBid() {
    Map<String, Object> map = new HashMap<String, Object>();
    try {
        ArrayList<Bid_log> bids = bid_log_service.getNumberOfBid();
        if (!bids.isEmpty()) {
            map.put("DATA", bids);
            map.put("STATUS", true);
            map.put("MESSAGE", "DATA FOUND!");
        } else {
            map.put("STATUS", true);
            map.put("MESSAGE", "DATA NOT FOUND");
        }
    } catch (Exception e) {
        map.put("STATUS", false);
        map.put("MESSAGE", "Error!");
        e.printStackTrace();
    }
    return new ResponseEntity<Map<String, Object>>(map, HttpStatus.OK);
}

From source file:com.example.api.UrlShortener.java

@RequestMapping(value = "/", method = RequestMethod.POST)
ResponseEntity<String> save(@RequestParam String url) {
    if (validator.isValid(url)) {
        String hash = getHash(url);
        String shorten = new StringBuilder(urlShortenerUrl).append('/').append(hash).toString();
        return new ResponseEntity<>(shorten, HttpStatus.OK);
    } else {/*from  w  w w. ja v  a  2  s .c  o  m*/
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:com.consol.citrus.samples.bakery.ReportOrdersIT.java

@CitrusTest
public void getOrders() {
    final String orderId = Functions.randomNumber(10L, null);
    variable("orderId", orderId);

    echo("First check order id not present");

    http().client(reportingClient).send().get("/reporting/orders");

    http().client(reportingClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT)
            .validationCallback(new AbstractValidationCallback<String>() {
                @Override//  www . ja va  2s.  c  om
                public void validate(String payload, Map headers, TestContext context) {
                    Assert.assertFalse(payload.contains(orderId));
                }
            });

    echo("Add some 'blueberry' order with id");

    http().client(reportingClient).send().put("/reporting").queryParam("id", "${orderId}")
            .queryParam("name", "blueberry").queryParam("amount", "1");

    http().client(reportingClient).receive().response(HttpStatus.OK);

    echo("Receive order id in list of produced goods");

    http().client(reportingClient).send().get("/reporting/orders");

    http().client(reportingClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT)
            .validationCallback(new AbstractValidationCallback<String>() {
                @Override
                public void validate(String payload, Map headers, TestContext context) {
                    Assert.assertTrue(payload.contains(orderId));
                }
            });
}

From source file:fi.helsinki.opintoni.web.rest.privateapi.LocalDevFileResource.java

@RequestMapping(value = "/{filename:.+}", method = RequestMethod.GET)
public ResponseEntity<byte[]> serve(@PathVariable String filename) throws IOException {
    return new ResponseEntity<>(filesMemory.getBytes(filename), HttpStatus.OK);
}

From source file:edu.pitt.dbmi.ccd.anno.index.IndexController.java

/**
 * Application index endpoint/*  www  .j  a  v  a  2s.  c o  m*/
 *
 * @return links to endpoints
 */
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<IndexResource> index() {
    return new ResponseEntity<>(assembler.buildIndex(), HttpStatus.OK);
}

From source file:com.consol.citrus.demo.devoxx.ReportOrderMailIT.java

@CitrusTest
public void shouldSendMail() {
    echo("Add 1000+ order and receive mail");

    variable("orderType", "chocolate");

    http().client(reportingClient).put("/reporting").queryParam("id", "citrus:randomNumber(10)")
            .queryParam("name", "${orderType}").queryParam("amount", "1001");

    http().client(reportingClient).response(HttpStatus.OK);

    echo("Receive report mail for 1000+ order");

    receive(mailServer).payload(new ClassPathResource("templates/mail.xml"))
            .header(CitrusMailMessageHeaders.MAIL_SUBJECT, "Congratulations!")
            .header(CitrusMailMessageHeaders.MAIL_FROM, "cookie-report@example.com")
            .header(CitrusMailMessageHeaders.MAIL_TO, "stakeholders@example.com");

    echo("Receive report with 1000+ order");

    http().client(reportingClient).get("/reporting/json");

    http().client(reportingClient).response(HttpStatus.OK).messageType(MessageType.JSON).payload(
            "{\"caramel\": \"@ignore@\",\"blueberry\": \"@ignore@\",\"chocolate\": \"@greaterThan(1000)@\"}");
}

From source file:gt.dakaik.rest.impl.CountryImpl.java

@Override
public ResponseEntity<Country> findAll(int idUsuario, String token) throws EntidadNoEncontradaException {
    return new ResponseEntity(repoCountry.getAll(), HttpStatus.OK);
}

From source file:web.ClientsRESTController.java

/**
 * Lists all clients through a REST API/*  www. j a  va2 s .co 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:com.baidu.stqa.signet.web.action.RemarkAction.java

/**
 * // w w  w .jav a2s. co  m
 * 
 * @param projectId
 * @param storyId
 * @param nodeId
 * @return
 */
@RequestMapping(value = "/project/{projectId}/story/{storyId}/node/{nodeId}/remark", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Remark>> getRemarks(@PathVariable long projectId, @PathVariable long storyId,
        @PathVariable long nodeId) {

    doLog(projectId);
    List<Remark> remarks = remarkService.getRemarksByNodeId(nodeId);
    return new ResponseEntity<List<Remark>>(remarks, HttpStatus.OK);
}