Example usage for io.netty.handler.codec.http HttpMethod GET

List of usage examples for io.netty.handler.codec.http HttpMethod GET

Introduction

In this page you can find the example usage for io.netty.handler.codec.http HttpMethod GET.

Prototype

HttpMethod GET

To view the source code for io.netty.handler.codec.http HttpMethod GET.

Click Source Link

Document

The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.

Usage

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapGetInJsendJsonUsingQueryString() {
    sendEvent(HttpMethod.GET, "/normal_get?format=json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("{\"code\":200,\"status\":\"success\",\"data\":\"Normal GET action\"}",
            httpResponse.toString());/*from ww w .j  a  v a  2 s . c  om*/
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapGetInJsendXml() {
    sendEvent(HttpMethod.GET, "/normal_get.xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertTrue(httpResponse.toString().startsWith("<response>"));
    assertTrue(httpResponse.toString().contains("<code>200</code>"));
    assertTrue(httpResponse.toString().contains("<status>success</status>"));
    assertTrue(httpResponse.toString().contains("<data class=\"string\">Normal GET action</data>"));
    assertTrue(httpResponse.toString().endsWith("</response>"));
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapGetInJsendXmlUsingQueryString() {
    sendEvent(HttpMethod.GET, "/normal_get?format=xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertTrue(httpResponse.toString().startsWith("<response>"));
    assertTrue(httpResponse.toString().contains("<code>200</code>"));
    assertTrue(httpResponse.toString().contains("<status>success</status>"));
    assertTrue(httpResponse.toString().contains("<data class=\"string\">Normal GET action</data>"));
    assertTrue(httpResponse.toString().endsWith("</response>"));
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNotFoundInJsendJson() {
    sendEvent(HttpMethod.GET, "/not_found.json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals(/*from ww w .j  av  a  2s. c o m*/
            "{\"code\":404,\"status\":\"error\",\"message\":\"Item not found\",\"data\":\"NotFoundException\"}",
            httpResponse.toString());
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNotFoundInJsendJsonUsingQueryString() {
    sendEvent(HttpMethod.GET, "/not_found?format=json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals(/*w w  w  .j av  a 2  s . co m*/
            "{\"code\":404,\"status\":\"error\",\"message\":\"Item not found\",\"data\":\"NotFoundException\"}",
            httpResponse.toString());
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNotFoundInJsendXml() {
    sendEvent(HttpMethod.GET, "/not_found.xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertTrue(httpResponse.toString().startsWith("<response>"));
    assertTrue(httpResponse.toString().contains("<code>404</code>"));
    assertTrue(httpResponse.toString().contains("<status>error</status>"));
    assertTrue(httpResponse.toString().contains("<message>Item not found</message>"));
    assertTrue(httpResponse.toString().contains("<data class=\"string\">NotFoundException</data>"));
    assertTrue(httpResponse.toString().endsWith("</response>"));
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNotFoundInJsendXmlUsingQueryString() {
    sendEvent(HttpMethod.GET, "/not_found?format=xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertTrue(httpResponse.toString().startsWith("<response>"));
    assertTrue(httpResponse.toString().contains("<code>404</code>"));
    assertTrue(httpResponse.toString().contains("<status>error</status>"));
    assertTrue(httpResponse.toString().contains("<message>Item not found</message>"));
    assertTrue(httpResponse.toString().endsWith("</response>"));
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNullPointerInJsendJson() {
    sendEvent(HttpMethod.GET, "/null_pointer.json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals(//from www .jav a  2  s.  co  m
            "{\"code\":500,\"status\":\"fail\",\"message\":\"Null and void\",\"data\":\"NullPointerException\"}",
            httpResponse.toString());
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNullPointerInJsendJsonUsingQueryString() {
    sendEvent(HttpMethod.GET, "/null_pointer?format=json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals(/*from www.j  a  v  a  2  s .co  m*/
            "{\"code\":500,\"status\":\"fail\",\"message\":\"Null and void\",\"data\":\"NullPointerException\"}",
            httpResponse.toString());
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNullPointerInJsendXml() {
    sendEvent(HttpMethod.GET, "/null_pointer.xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertTrue(httpResponse.toString().startsWith("<response>"));
    assertTrue(httpResponse.toString().contains("<code>500</code>"));
    assertTrue(httpResponse.toString().contains("<status>fail</status>"));
    assertTrue(httpResponse.toString().contains("<message>Null and void</message>"));
    assertTrue(httpResponse.toString().contains("<data class=\"string\">NullPointerException</data>"));
    assertTrue(httpResponse.toString().endsWith("</response>"));
}