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:com.boxedfolder.carrot.web.client.CrudResource.java

@JsonView(View.Client.class)
@ResponseStatus(HttpStatus.OK)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public void delete(@PathVariable("id") Long id) {
    service.delete(id);/*from   w  w w  .j  a  v a  2s .c o  m*/
}

From source file:comsat.sample.ui.SampleWebStaticApplicationTests.java

@Test
public void testHome() throws Exception {
    ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port,
            String.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
    assertTrue("Wrong body (title doesn't match):\n" + entity.getBody(),
            entity.getBody().contains("<title>Static"));
}

From source file:monkeys.web.BananasController.java

@RequestMapping(method = RequestMethod.DELETE, value = "/{id}")
public ResponseEntity<Void> deleteBanana(@PathVariable Long id) {
    bananaRepository.delete(id);//from ww w .j  a v a 2s  .  c  o  m
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(headers, HttpStatus.OK);
}

From source file:com.rx4dr.service.controller.RestExceptionHandler.java

@ExceptionHandler({ UnknownResourceException.class })
public ResponseEntity<Map<String, String>> handleUnknownResourceException(UnknownResourceException e) {
    logger.debug("Enyeting handleUnknownResourceException");
    Map<String, String> map = new HashMap<String, String>();
    map.put(status, HttpStatus.NOT_FOUND.toString());
    map.put(error, e.getClass().getSimpleName());
    map.put(description, e.getMessage());
    return new ResponseEntity<Map<String, String>>(map, HttpStatus.OK);

}

From source file:net.eusashead.hateoas.response.impl.OptionsResponseBuilderImpl.java

@Override
public ResponseEntity<T> build() {
    ResponseEntity<T> responseEntity;
    if (entity == null) {
        responseEntity = new ResponseEntity<T>(headers, HttpStatus.OK);
    } else {//from  ww  w.jav  a 2  s .co  m
        responseEntity = new ResponseEntity<T>(entity, headers, HttpStatus.OK);
    }
    return responseEntity;
}

From source file:net.eusashead.hateoas.response.impl.GetResponseBuilderImplTest.java

@Test
public void testEntityBuild() throws Exception {
    Entity entity = new Entity("foo");
    ResponseEntity<Entity> response = builder.entity(entity).build();
    Assert.assertNotNull(response);//from ww  w  .ja v a 2  s. c om
    Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
    Assert.assertEquals(entity, response.getBody());
    Assert.assertNull(response.getHeaders().getETag());
    Assert.assertEquals(-1l, response.getHeaders().getLastModified());
    Assert.assertNull(response.getHeaders().getCacheControl());
    Assert.assertEquals(-1l, response.getHeaders().getExpires());
    Assert.assertEquals(-1l, response.getHeaders().getDate());
}

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

/**
 *
 * @param code/*from w  w w  .j  a  v a 2  s. co m*/
 * @return
 */
@RequestMapping(value = "/codigo/{code}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Productos> getOPriductoByCode(@PathVariable("code") String code) {
    Productos p = se.getProductoByCode(code);
    return new ResponseEntity<>(p, HttpStatus.OK);
}

From source file:io.syndesis.runtime.ConnectorsITCase.java

@Test
public void connectorListWithValidToken() {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    Class<ListResult<Connector>> type = (Class) ListResult.class;
    ResponseEntity<ListResult<Connector>> response = get("/api/v1/connectors", type);
    assertThat(response.getStatusCode()).as("component list status code").isEqualTo(HttpStatus.OK);
    ListResult<Connector> result = response.getBody();
    assertThat(result.getTotalCount()).as("connectors total").isGreaterThan(2);
    assertThat(result.getItems().size()).as("connector list").isGreaterThan(2);
}

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

@Override
public ResponseEntity<DocumentType> doCreate(DocumentType documentType, int idUsuario, String token)
        throws EntidadDuplicadaException {
    return new ResponseEntity(repoDocumentType.save(documentType), HttpStatus.OK);
}