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:org.echocat.marquardt.example.ExampleServiceController.java

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

From source file:com._8x8.presentation.restfulController.GCMRestController.java

@RequestMapping(value = "/gcm/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<GCM>> getAllGCM() {
    List<GCM> GCMs = _gcmService.GetGCMs();

    if (GCMs.isEmpty()) {
        return new ResponseEntity<List<GCM>>(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND
    }//from w ww .ja v a2 s.c  o m
    return new ResponseEntity<List<GCM>>(GCMs, HttpStatus.OK);
}

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

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

From source file:com.zalando.zmon.boot.jetty.AbstractRunner.java

@Test
public void run() throws InterruptedException {
    RestTemplate rest = new RestTemplate();
    for (int i = 0; i < 100; i++) {
        ResponseEntity<String> response = rest
                .getForEntity("http://localhost:" + port + "/api/simple/" + i + "/complex", String.class);
        Assertions.assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
    }/*w  w  w .j a  v  a 2  s . c  o m*/

    ResponseEntity<String> metrics = rest.getForEntity("http://localhost:" + port + "/metrics", String.class);
    Assertions.assertThat(metrics.getBody()).contains(LINE);
    // to use browser /metrics
    //      TimeUnit.MINUTES.sleep(2);
}

From source file:it.reply.orchestrator.controller.TemplateController.java

/**
 * Get the template by deploymentId./*from  w w  w.  ja va  2 s.  c  o m*/
 * 
 * @param uuid
 *          the uuid of the deployment
 * @return the template
 */
@RequestMapping(value = "/deployments/{deploymentId}/template", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public String getOrchestrator(@PathVariable("deploymentId") String uuid) {
    return templateService.getTemplate(uuid);
}

From source file:biz.dfch.activiti.wrapper.controller.ProcessInvocationController.java

@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public ResponseEntity<Void> invokeProcess(@Valid @RequestBody ProcessMetadata processMetadata) {
    LOG.info("POST /process-invocation called");
    try {/*from  w  w w .  ja  v  a 2s  . c om*/
        LOG.debug(objectMapper.writeValueAsString(processMetadata));
    } catch (JsonProcessingException e) {
        LOG.error("Conversion of request body to JSON failed", e);
    }
    activitiService.invokeProcess(processMetadata);
    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:com.javiermoreno.springboot.mvc.minimal.httpd.PingController.java

@RequestMapping(value = "/long", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
void longPing(HttpServletResponse response) throws IOException, InterruptedException {
    response.setBufferSize(0);/*from   ww w .  j a  v a 2s .  com*/
    PrintWriter out = response.getWriter();
    out.println();
    out.flush();
    for (int i = 0; i < 60 * 5; i++) {
        out.format("Current server time: %s.\r\n", new Date());
        out.flush();
        Thread.sleep(1000);
    }
}

From source file:br.com.hyperclass.snackbar.restapi.MenuController.java

@RequestMapping(value = "/menu", method = RequestMethod.GET)
public ResponseEntity<ProductsWrapper> menuItemProducts() {
    return new ResponseEntity<>(new ProductsWrapper(menu.getProducts()), HttpStatus.OK);
}

From source file:ch.wisv.areafiftylan.web.controller.WebPropertiesController.java

@RequestMapping(value = "/googlemapskey", method = RequestMethod.GET)
public ResponseEntity<?> getGoogleMapsKey() {
    return createResponseEntity(HttpStatus.OK, this.googleMapsKey);
}

From source file:org.sharetask.data.IntegrationTest.java

@BeforeClass
public static void login() throws Exception {
    final DefaultHttpClient client = new DefaultHttpClient();
    final HttpPost httpPost = new HttpPost(BASE_URL + "/user/login");
    httpPost.addHeader(new BasicHeader("Content-Type", "application/json"));
    final StringEntity httpEntity = new StringEntity(
            "{\"username\":\"dev1@shareta.sk\"," + "\"password\":\"password\"}");
    System.out.println(EntityUtils.toString(httpEntity));
    httpPost.setEntity(httpEntity);/* w w w .  j a  v a2  s.c  om*/

    //when
    final HttpResponse response = client.execute(httpPost);

    //then
    Assert.assertEquals(HttpStatus.OK.value(), response.getStatusLine().getStatusCode());
    client.getCookieStore().getCookies();
    for (final Cookie cookie : client.getCookieStore().getCookies()) {
        if (cookie.getName().equals("JSESSIONID")) {
            DOMAIN = cookie.getDomain();
            SESSIONID = cookie.getValue();
        }
    }
}