Package jodd.http

Examples of jodd.http.HttpResponse


        "{0=Person{name='Aaa', data=1}, 1=Person{name='Bbb', data=2}, 2=Person{name='Ccc', data=3}}", response.bodyText().trim());
  }

  @Test
  public void testBackBack() {
    HttpResponse response = HttpRequest.get("localhost:8173/hello.backback.html").send();
    assertEquals("default.big", response.bodyText().trim());
  }
View Full Code Here


    MadvocSuite.stopTomcat();
  }

  @Test
  public void testArgs() {
    HttpResponse response;
    response = HttpRequest.get("localhost:8173/args.hello.html?id=1").send();

    assertEquals("+ mad 1voc + jodd 1", response.bodyText().trim());
  }
View Full Code Here

  }

  @Test
  public void testArgs2() {
    ArgsAction.User.counter = 0;
    HttpResponse response;
    response = HttpRequest.get("localhost:8173/args.world.html")
        .query("who", "me")
        .query("name", "Jupiter")
        .query("hello.id", "1")
        .query("id", "3")
        .query("muti", "7")
        .send();

    assertEquals("**me+Jupiter+1+3**Jupiter**bye-true-7**8**jojo", response.bodyText().trim());
  }
View Full Code Here

    MadvocSuite.stopTomcat();
  }

  @Test
  public void testAsync() {
    HttpResponse response;
    response = HttpRequest.get("localhost:8173/async.html").send();

    assertEquals("async TASK!", response.bodyText().trim());
  }
View Full Code Here

    MadvocSuite.stopTomcat();
  }

  @Test
  public void testForwardTo() {
    HttpResponse response;

    response = HttpRequest.get("localhost:8173/alpha.html").send();
    assertEquals("alpha.jsp", response.bodyText().trim());

    response = HttpRequest.get("localhost:8173/alpha.hello.html").send();
    assertEquals("alpha.hello.jsp", response.bodyText().trim());

    response = HttpRequest.get("localhost:8173/alpha.ciao.html").send();
    assertEquals("alpha.hello.jsp", response.bodyText().trim());

    response = HttpRequest.get("localhost:8173/alpha.ciao2.html").send();
    assertEquals("alpha.hello.jsp", response.bodyText().trim());

    response = HttpRequest.get("localhost:8173/alpha.hola.html").send();
    assertEquals("alpha.hello.jsp", response.bodyText().trim());

    response = HttpRequest.get("localhost:8173/alpha.holahoopa.html").send();
    assertEquals("alpha.hola.jsp", response.bodyText().trim());

    response = HttpRequest.get("localhost:8173/alpha.home.html").send();
    assertEquals("hello", response.bodyText().trim());

    response = HttpRequest.get("localhost:8173/alpha.home2.html").send();
    assertEquals("Hello world", response.bodyText().trim());
  }
View Full Code Here

    assertEquals("Hello world", response.bodyText().trim());
  }

  @Test
  public void testRedirectTo() {
    HttpResponse response;
    HttpBrowser browser = new HttpBrowser();

    response = browser.sendRequest(HttpRequest.get("localhost:8173/alpha.red1.html"));
    assertEquals("alpha.jsp", response.bodyText().trim());

    response = browser.sendRequest(HttpRequest.get("localhost:8173/alpha.red2.html"));
    assertEquals("hello", response.bodyText().trim());

    response = browser.sendRequest(HttpRequest.get("localhost:8173/alpha.world.html"));
    assertEquals("Hello world planet Mars and Universe 173", response.bodyText().trim());

    response = browser.sendRequest(HttpRequest.get("localhost:8173/alpha.postme.html"));
    assertEquals("alpha.hello.jsp", response.bodyText().trim());
  }
View Full Code Here

    assertEquals("alpha.hello.jsp", response.bodyText().trim());
  }

  @Test
  public void testText() {
    HttpResponse response;

    response = HttpRequest.get("localhost:8173/alpha.txt.html").send();
    assertEquals("some text", response.bodyText().trim());
  }
View Full Code Here

    assertEquals("some text", response.bodyText().trim());
  }

  @Test
  public void testChain() {
    HttpResponse response = HttpRequest.get("localhost:8173/hello.chain.html?chain=7").send();
    assertEquals("chain:9", response.bodyText().trim());
  }
View Full Code Here

    assertEquals("chain:9", response.bodyText().trim());
  }

  @Test
  public void testNoResult() {
    HttpResponse response = HttpRequest.get("localhost:8173/alpha.noresult.html").send();
    assertEquals("noresult", response.bodyText().trim());
  }
View Full Code Here

    MadvocSuite.stopTomcat();
  }

  @Test
  public void testBookGet() {
    HttpResponse response;
    response = HttpRequest.get("localhost:8173/book/123").send();

    assertEquals("MyBook: 123:Songs of Distant Earth.", response.bodyText().trim());
  }
View Full Code Here

TOP

Related Classes of jodd.http.HttpResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.