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:sample.jersey.SampleJerseyApplicationTests.java

@Test
public void contextLoads() {
    ResponseEntity<String> entity = this.restTemplate.getForEntity("http://localhost:" + this.port + "/hello",
            String.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
}

From source file:org.moserp.product.rest.ProductControllerTest.java

@Test
public void testProductEan() {
    Response imageResponse = given().when().get("/products/" + product.getId() + "/ean");
    assertNotNull("response", imageResponse);
    imageResponse.then().statusCode(HttpStatus.OK.value()).and().contentType(MediaType.IMAGE_PNG_VALUE);
}

From source file:com.diagrama.repository.PeriodoController.java

@RequestMapping(value = "/periodo/{periodo_id}", method = RequestMethod.GET)
public ResponseEntity<?> BuscarPeriodo(@PathVariable int periodo_id) {
    PeriodosLectivos periodosLectivos = periodoRepository.findOne(periodo_id);
    return new ResponseEntity<>(periodosLectivos, HttpStatus.OK);
}

From source file:com.seguriboxltv.ws.HsmKeyRest.java

@RequestMapping(value = "/sdhsmkey", method = RequestMethod.GET, headers = "Accept=application/json")
@ResponseBody/*from  ww w. java2  s . c  o m*/
public ResponseEntity<List<HSMKey>> getAllHsmKey() {
    List<HSMKey> list = null;

    try {
        list = hsmKeyService.SDGetAll();
    } catch (Exception e) {
    }
    return new ResponseEntity<>(list, HttpStatus.OK);
}

From source file:com.hypersocket.permissions.json.PermissionsController.java

@AuthenticationRequired
@RequestMapping(value = "permissions/permission/{resourceKey}/", method = RequestMethod.GET, produces = {
        "application/json" })
@ResponseBody//from  w  ww . j  a v a2s  .  c o m
@ResponseStatus(value = HttpStatus.OK)
public ResourceStatus<Permission> getPermission(HttpServletRequest request, HttpServletResponse response,
        @PathVariable String resourceKey) throws AccessDeniedException, UnauthorizedException {

    permissionService.setCurrentSession(sessionUtils.getActiveSession(request),
            sessionUtils.getLocale(request));
    try {

        return new ResourceStatus<Permission>(permissionService.getPermission(resourceKey));

    } finally {
        permissionService.clearPrincipalContext();
    }

}

From source file:SampleWebStaticApplicationTests.java

@Test
public void testHome() throws Exception {
    ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port,
            String.class);
    assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
    assertThat(entity.getBody()).contains("<title>Static");
}

From source file:org.echocat.marquardt.example.ExampleServiceController.java

@SuppressWarnings("UnusedParameters")
@RequestMapping(value = "/someProtectedResourceWithPayload", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public void someProtectedResourceWithPayload(final String payload) throws IOException {
    LOGGER.info("/exampleservice/someProtectedResourceWithPayload received a request");
}

From source file:com._8x8.presentation.restController.UserRestController.java

@RequestMapping(value = "/users/", method = RequestMethod.GET)
public ResponseEntity<List<User>> listAllUsers() {

    List<User> users = _userService.GetUsers();//  .findAllUsers();

    if (users.isEmpty()) {
        return new ResponseEntity<List<User>>(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND
    }//w  ww .  j a v  a2 s  .co  m
    return new ResponseEntity<List<User>>(users, HttpStatus.OK);
}

From source file:edu.infsci2560.services.LocationsService.java

@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity<Location> list(@PathVariable("id") Long id) {
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(repository.findOne(id), headers, HttpStatus.OK);
}

From source file:springfox.documentation.spring.web.dummy.controllers.PetGroomingService.java

@RequestMapping(value = "voidMethod/{input}", method = RequestMethod.DELETE, headers = {
        "Accept=application/xml,application/json" })
@ResponseStatus(value = HttpStatus.OK, reason = "Just testing")
public void groomingFunctionThatReturnsVoid(@PathVariable("input") String input) throws Exception {
}