Example usage for org.springframework.http HttpStatus FOUND

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

Introduction

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

Prototype

HttpStatus FOUND

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

Click Source Link

Document

302 Found .

Usage

From source file:todo.TodoSteps.java

@Given("^Todo list is empty$")
public void empty_todos() {
    designer.http().client(todoListClient).send().delete("/todolist");

    designer.http().client(todoListClient).receive().response(HttpStatus.FOUND);
}

From source file:io.spring.initializr.web.project.MainControllerEnvIntegrationTests.java

@Test
public void downloadCliWithCustomRepository() throws Exception {
    ResponseEntity<?> entity = getRestTemplate().getForEntity(createUrl("/spring"), String.class);
    assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
    String expected = "https://repo.spring.io/lib-release/org/springframework/boot/spring-boot-cli/1.1.4.RELEASE/spring-boot-cli-1.1.4.RELEASE-bin.zip";
    assertThat(entity.getHeaders().getLocation()).isEqualTo(new URI(expected));
}

From source file:com.opensearchserver.hadse.index.IndexController.java

@RequestMapping(method = RequestMethod.GET, value = "/{index_name}")
@ResponseBody/*from  ww w  .ja  v  a2 s. com*/
public HttpEntity<?> indexExists(@PathVariable String index_name) {
    if (!IndexCatalog.exists(index_name))
        return new ResponseEntity<String>("Index not found: " + index_name, HttpStatus.NOT_FOUND);
    return new ResponseEntity<String>("Index found", HttpStatus.FOUND);

}

From source file:com.consol.citrus.samples.todolist.TodoListLoadTestIT.java

@Parameters({ "designer" })
@CitrusTest/*  ww w  .  j  a  va2 s  . c  o m*/
public void testAddTodo(@Optional @CitrusResource TestDesigner designer) {
    designer.http().client(todoClient).send().post("/todolist").contentType("application/x-www-form-urlencoded")
            .payload("title=citrus:concat('todo_', citrus:randomNumber(10))");

    designer.http().client(todoClient).receive().response(HttpStatus.FOUND);
}

From source file:todo.TodoSteps.java

@When("^I add entry \"([^\"]*)\"$")
public void add_entry(String todoName) {
    designer.http().client(todoListClient).send().post("/todolist")
            .contentType("application/x-www-form-urlencoded").payload("title=" + todoName);

    designer.http().client(todoListClient).receive().response(HttpStatus.FOUND);
}

From source file:com.monitor.controller.MessageController.java

@ApiOperation(value = "show", notes = "show a message")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<Message> show(@PathVariable(name = "id", required = true) String id) {

    final Message messageFound = service.findOne(id);

    if (messageFound != null) {
        return new ResponseEntity<>(messageFound, HttpStatus.FOUND);
    } else {/*from  w ww  .j  av  a 2 s.c om*/
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }

}

From source file:org.cloudfoundry.identity.uaa.integration.LoginInfoEndpointIntegrationTests.java

/**
 * tests a happy-day flow of the <code>/login</code> endpoint
 *//*from  w  w  w.  j  a v  a2 s  . c  om*/
@Test
public void testHappyDayHtml() throws Exception {

    HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));

    HttpStatus status = HttpStatus.FOUND;
    String location = "/login";
    ResponseEntity<Void> response = null;
    while (status == HttpStatus.FOUND) {
        response = serverRunning.getForResponse(location, headers);
        status = response.getStatusCode();
        if (status == HttpStatus.FOUND) {
            location = response.getHeaders().getLocation().toString();
            System.err.println("Redirected to " + location);
        }
    }

    ResponseEntity<String> finalResponse = serverRunning.getForString(location, headers);
    String body = finalResponse.getBody().toString();
    // System.err.println(body);
    assertNotNull(body);
    assertTrue("Wrong body: " + body, body.contains("<form id="));

}

From source file:org.zaizi.SensefySearchUiApplicationTests.java

@Test
public void homePageLoads() {
    ResponseEntity<String> response = template.getForEntity("http://localhost:" + port + "/", String.class);
    assertEquals(HttpStatus.FOUND, response.getStatusCode());
}

From source file:fr.patouche.soat.google.GoogleApplicationTests.java

@Test
public void everythingIsSecuredByDefault() throws Exception {
    TestRestTemplate restTemplate = new TestRestTemplate();
    ResponseEntity<Void> entity = restTemplate.getForEntity("http://localhost:" + this.port, Void.class);
    assertThat(entity.getStatusCode(), is(HttpStatus.FOUND));
    assertThat(entity.getHeaders().getLocation(),
            is(equalTo(URI.create("http://localhost:" + this.port + "/login"))));
}

From source file:todo.TodoSteps.java

@When("^I remove entry \"([^\"]*)\"$")
public void remove_entry(String todoName) {
    designer.http().client(todoListClient).send().delete("/todo?title=" + todoName);

    designer.http().client(todoListClient).receive().response(HttpStatus.FOUND)
            .messageType(MessageType.PLAINTEXT);
}